event.c


Log

Author Commit Date CI Message
Azat Khuzhin 23c2914f 2018-04-24T00:59:11 Notify event base if there are no more events, so it can exit without delay Fixes: #623
Azat Khuzhin 08a0d366 2018-02-27T21:12:14 Fix base unlocking in event_del() if event_base_set() runned in another thread Image next situation: T1: T2: event_del_() lock the event.ev_base.th_base_lock event_del_nolock_() event_set_base() unlock the event.ev_base.th_base_lock In this case we will unlock the wrong base after event_del_nolock_() returns, and deadlock is likely to happens, since event_base_set() do not check any mutexes (due to it is possible to do this only if event is not inserted anywhere). So event_del_() has to cache the base before removing the event, and cached base.th_base_lock after.
Azat Khuzhin f0fd92f2 2018-02-27T21:08:35 Convert event_debug_*() helpers from macros to static functions
yongqing.jiao 6cce7458 2017-12-09T14:39:07 If precise_time is false, we should not set EVENT_BASE_FLAG_PRECISE_TIMER Fixes: 630f077c296de61c7b99ed83bf30de11e75e2740 ("Simple unit tests for monotonic timers")
James Synge 27934f0b 2017-08-07T11:06:28 Fix race in access to ev_res from event loop with event_active() Detected using ThreadSanitizer, resolved by capturing the value of ev_res in a local variable while the event is locked, then passing that captured variable to the callback. TSAN report: I0728 14:35:09.822118 WARNING: ThreadSanitizer: data race (pid=815501) I0728 14:35:09.822186 Write of size 2 at 0x7b2c00001bf2 by thread T80 (mutexes: write M1110835549570434736): I0728 14:35:09.822248 #0 event_active_nolock_ libevent/event.c:2893:14 (0a2b90577e830d775300664df77d0b91+0x1fdab28) I0728 14:35:09.822316 #1 event_active libevent/event.c:2858:2 (0a2b90577e830d775300664df77d0b91+0x1fdd10e) I0728 14:35:09.822379 #2 Envoy::Event::TimerImpl::enableTimer(std::chrono::duration<long, std::ratio<1l, 1000l> > const&) envoy/source/common/event/timer_impl.cc:24:5 (0a2b90577e830d775300664df77d0b91+0x459fa0) ... I0728 14:35:09.824146 Previous read of size 2 at 0x7b2c00001bf2 by main thread: I0728 14:35:09.824232 #0 event_process_active_single_queue libevent/event.c:1646:33 (0a2b90577e830d775300664df77d0b91+0x1fdf83d) I0728 14:35:09.824350 #1 event_process_active libevent/event.c (0a2b90577e830d775300664df77d0b91+0x1fd9ad8) I0728 14:35:09.824445 #2 event_base_loop libevent/event.c:1961 (0a2b90577e830d775300664df77d0b91+0x1fd9ad8) I0728 14:35:09.824550 #3 Envoy::Event::DispatcherImpl::run(Envoy::Event::Dispatcher::RunType) envoy/source/common/event/dispatcher_impl.cc:166:3 (0a2b90577e830d775300664df77d0b91+0x4576d9) ... Fixes: #543 (pull-request)
José Luis Millán 0b4b0efd 2015-04-13T08:54:52 Return from event_del() after the last event callback termination Delete the event from the queue before blocking for the current event callback termination. Ensures that no callback is being executed when event_del() returns, hence making this function a secure mechanism to access data which is handled in the event callack. Fixes: #236 Fixes: #225 Refs: 6b4b77a Fixes: del_wait
Azat Khuzhin 177e2171 2017-03-24T16:49:59 Make event_count macros cleaner Fixes: #489
Azat Khuzhin 9081b66c 2017-03-12T20:50:35 Export symbols for -fvisibility=hidden (under cmake) Fixes: #442
Azat Khuzhin 94e7dceb 2017-01-29T17:23:14 Fix -Werror=implicit-fallthrough (fixes gcc-7) Fixes: #447
Nicholas Marriott 88640aa1 2015-12-27T02:15:03 event_reinit: make signals works after fork() without evsig_add() event_reinit() removes the event, but only evsig_add puts it back. So any signals set up before event_reinit will be ignored until another signal is added. Fixes: #307
Nicholas Marriott ad0c237b 2015-12-27T01:43:37 event_reinit: always re-init signal's socketpair Before this patch event_reinit() only closes the signal socketpair fds and recreates them if signals have been added, but this is wrong, since socketpair fds created on backend init, and if we will not re-create them bad things in child/parent signal handling will happens (and indeed this is what happens for non-reinit backends like select). Fixes: #307
Azat Khuzhin 7c8d0152 2015-10-30T13:34:30 Free event queues even for recursive finalizers For finalizers we can register yet another finalizer out from finalizer, and iff finalizer will be in active_later_queue we can add finalizer to activequeues, and we will have events in activequeues after event_base_free() returns, which is not what we want (we even have an assertion for this). A simple case is bufferevent with underlying (i.e. filters) in inactive queue. Fixes: regress bufferevent/bufferevent_socket_filter_inactive
Azat Khuzhin f337296a 2015-10-04T03:35:43 Fix checking for make_base_notifiable() Fixes: a068f2e5 ("event_debug_created_threadable_ctx_: fix compilation without debug mode") Found-after: 3e56da23 ("travis: add builds without debug mode into matrix")
Azat Khuzhin a068f2e5 2015-09-29T20:36:39 event_debug_created_threadable_ctx_: fix compilation without debug mode The following command failed before: $ ./configure --disable-debug-mode Fixes: dcfb19a27b7760299bc9e7291c9abd88c59fd91a ("Debug mode option to error on evthread init AFTER other event calls.")
Mark Ellzey dcfb19a2 2015-05-15T02:58:14 Debug mode option to error on evthread init AFTER other event calls. - A handy event_enable_debug_mode() feature which will error and abort the application if any thread-aware libevent functions are called BEFORE the evthread API has been initialized (manually, or through evthread_use_windows_threads() / evthread_use_pthreads() - This is done by setting the global debug variable 'event_debug_created_threadable_ctx_' whenever the following functions are called: evthreadimpl_lock_alloc_() evthreadimpl_cond_alloc_() event_base_new_with_config() <- this checks to see if the thread callbacks are enabled first, so we have to manually set the variable. - Example: int main(int argc, char ** argv) { struct event_base * base; event_enable_debug_mode(); base = event_base_new(); evthread_use_pthreads(); return 0; } When executed, the program will throw an error and exit: [err] evthread initialization must be called BEFORE anything else!
Greg Hazel 6e7a580c 2015-03-24T17:45:52 tab
Greg Hazel 38cef641 2015-03-24T17:29:40 fix the return value of event_deferred_cb_schedule_
Nick Mathewson a77a82a0 2015-02-04T08:37:32 Merge remote-tracking branch 'azat/be-pair-fix-freeing-shared-lock-v5'
Azat Khuzhin e5c87d18 2015-01-26T00:29:15 event_free_debug_globals_locks(): disable lock debugging This will allow to use library event after event_free_debug_globals_locks()/libevent_global_shutdown() without invalid read/write's.
Azat Khuzhin 941faaed 2015-01-08T04:45:27 event: call event_disable_debug_mode() in libevent_global_shutdown() This will avoid leaking of event_debug_map_HT_GROW I buildin it into libevent_glboal_shutdown() because event_disable_debug_mode() -> event_free_debug_globals() -> event_free_debug_globals_locks() will clean event_debug_map_lock_ that used in event_disable_debug_mode().
Andrea Shepard f2645f80 2014-11-19T12:18:05 Implement new/free for struct evutil_monotonic_timer and export monotonic time functions
Nick Mathewson 37145c56 2014-11-30T21:07:55 Merge remote-tracking branch 'public/patches-2.0' Conflicts: ChangeLog event.c
vjpai 3c7d6fca 2014-09-22T12:19:37 Fix race caused by event_active There is a race between manual event_active and natural event activation. If both happen at the same time on the same FD, they would both be protected by the same event base lock except for 1 LoC where the fields of struct event are read without any kind of lock. This commit does those reads into local variables inside the lock and then invokes the callback with those local arguments outside the lock. In 2.0-stable, none of this is inside the lock; in HEAD, only the callback is read inside the lock. This gets the callback and all 3 arguments inside the lock before calling it outside the lock.
John Ohl 3cc0eace 2014-09-16T22:25:52 Fix use-after-free error in EV_CLOSURE_EVENT callback
Nick Mathewson ec99dd82 2014-03-18T11:25:58 Fix a use-after-free error on EV_CLOSURE_EVENT_FINALIZE callbacks After running the callback, we were checking evcb->evcb_closure to decide whether to call mm_free(ev). But the callback itself might have freed ev, so we need to grab that field first Found with AddressSanitizer
Nick Mathewson 98059721 2014-03-06T10:09:03 Move assert(ev) to before we use ev in EV_CLOSURE_EVENT_FINALIZE case Based on a patch from Harlan Stenn.
John Ohl 2ea15ed0 2014-01-27T14:54:55 Tweaked callbacks to prevent race condition (https://github.com/libevent/libevent/issues/104)
John Ohl 40830f16 2014-01-27T13:03:36 Tweaked callbacks to prevent race condition (https://github.com/libevent/libevent/issues/104)
Diego Giagio b1b69ac7 2014-01-17T23:20:42 Implemented EV_CLOSED event for epoll backend (EPOLLRDHUP). - Added new EV_CLOSED event - detects premature connection close by clients without the necessity of reading all the pending data. Does not depend on EV_READ and/or EV_WRITE. - Added new EV_FEATURE_EARLY_CLOSED feature for epoll. Must be supported for listening to EV_CLOSED event. - Added new regression test: test-closed.c - All regression tests passed (test/regress and test/test.sh) - strace output of test-closed using EV_CLOSED: socketpair(PF_LOCAL, SOCK_STREAM, 0, [6, 7]) = 0 sendto(6, "test string\0", 12, 0, NULL, 0) = 12 shutdown(6, SHUT_WR) = 0 epoll_ctl(3, EPOLL_CTL_ADD, 7, {EPOLLRDHUP, {u32=7, u64=7}}) = 0 epoll_wait(3, {{EPOLLRDHUP, {u32=7, u64=7}}}, 32, 3000) = 1 epoll_ctl(3, EPOLL_CTL_MOD, 7, {EPOLLRDHUP, {u32=7, u64=7}}) = 0 fstat(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 4), ...}) mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYM... write(1, "closed_cb: detected connection close "..., 45) = 45
Nick Mathewson f9e091bf 2014-01-06T12:11:30 Merge remote-tracking branch 'asweeny86/event-count-max'
Andrew Sweeney efbd3dcf 2014-01-05T16:29:52 Fixed bug using wrong variable in max event compare
Andrew Sweeney 5173bef5 2013-12-30T14:06:20 Add access to max event count stats This commit provides an interface for accessing and resetting the maximum number of events in a given period. This information provides better insight into event queue pressure.
Nick Mathewson 87fa2b00 2013-12-23T20:46:38 Unit tests for active_by_fd; unsupport active_by_fd(TIMEOUT) [It turns out that event_base_active_by_fd(TIMEOUT) didn't actually work right. Feel free to add it back in as a patch.]
Nick Mathewson 48659433 2013-12-21T23:32:10 Add event_base_active_by_signal by analogy
Nick Mathewson 5c9da9a8 2013-12-21T23:21:33 Sanity-check arguments to event_base_active_by_fd()
Nick Mathewson 93369ff4 2013-12-21T23:15:41 Merge remote-tracking branch 'ghazel/event_base_active_by_fd'
Nick Mathewson 1c06985a 2013-08-06T20:00:53 Add an assertion for another of the complaints from coverity. See 1b065d07df196
Nick Mathewson 69b5c647 2013-08-06T19:08:42 Move event_debug_note_teardown_ before mm_free. This isn't a bug, since only the pointer value of ev was used, but it's probably best not to tempt fate. Found by coverity.
Nick Mathewson 1b065d07 2013-08-06T19:06:58 Add some assertions to please coverity. In event_process_active_single_queue, EVLIST_INIT must be set on any event that uses one of the event-only closures, and so "ev" will be set in those cases. But coverity's worried here (CIDs numerous). So instead, just add the assertions that should make it happy.
Mobai Zhang 0fa107d8 2013-07-02T16:01:02 Added event_base_get_num_events()
Nick Mathewson 3dc2d8ab 2013-05-28T10:14:51 Remove a debugging assert that should not have been left in
Azat Khuzhin d3d999a1 2013-05-10T20:22:56 Missed lock acquire/release in event_base_cancel_single_callback_() Call backtrace: ... event_queue_remove_active() event_callback_cancel_nolock_() event_base_cancel_single_callback_() event_base_free_() event_base_free() ... Fix for e9ebef83
Nick Mathewson f2925d78 2013-04-30T22:57:25 Fix a windows compilation regression This is github issue #57; reported by "efekty". I assume the compiler is MSVC.
Nick Mathewson 3555befd 2013-04-26T12:27:05 Merge branch '21_deadlock_fix_v2'
Nick Mathewson 5d11f4f3 2013-04-26T11:57:40 Make the event_finalize* functions return an error code
Nick Mathewson a800b913 2013-04-26T11:36:43 More documentation for finalization feature
Nick Mathewson e9ebef83 2013-04-09T21:14:52 Always run pending finalizers when event_base_free() is called There was actually a bug in the original version of this: it tried to run the finalizers after (potentially) setting current_base to NULL; but those finalizers could themselves (potentially) be invoking stuff that needed to know about the current event_base. So the right time to do it is _before_ clearing current_base.
Nick Mathewson 8eedeabe 2013-03-28T14:13:19 Implement event_finalize() and related functions to avoid certain deadlocks
Nick Mathewson 5e6fa2a3 2013-04-24T13:23:15 event_base_update_cache_time should be a no-op if the loop isn't running
Nate Rosenblum 9443868d 2013-03-05T11:29:33 Double-check next timeout when adding events When resuming the system from a suspended state, the ev_timeout field of a scheduled timer event may be in the past. This leads to unexpected behavior when scheduling a short-duration timer event immediately after returning from suspension, because the new event does not land on top of the timeout minheap and so the event loop (blocked on a possibly long-duration timeout) is not notified. This patch checks for this condition and, if it obtains, notifies the event loop.
Patrick Pelletier 0c6ec5d8 2013-02-07T17:20:08 use FormatMessage for winsock errors as discussed here: http://archives.seul.org/libevent/users/Feb-2013/msg00004.html
Nick Mathewson 5623e803 2013-02-12T15:10:50 Make event_remove_timer behave correctly with persistent timers
Greg Hazel 865a1426 2013-01-16T16:31:08 event_base_active_by_fd
Nick Mathewson bf7a0ff2 2013-01-11T16:37:34 When EWOULDBLOCK is not EAGAIN, treat it as equivalent to it Acording to http://stackoverflow.com/questions/7003234/which-systems-define-eagain-and-ewouldblock-as-different-values there are some older unixes that distinguish these error.s
Nick Mathewson f2703b2e 2012-11-18T01:40:13 Fix a warning when building without threading.
Nick Mathewson e3b2e086 2012-11-16T16:15:03 Add an event_remove_timer() to remove timer on an event without deleting it
Nick Mathewson 1fda4928 2012-11-16T12:06:40 Merge remote-tracking branch 'origin/patches-2.0'
Nick Mathewson e3cccf38 2012-11-16T11:55:27 Avoid crash when event_pending() called with no event_base set on event Instead, give a warning and return 0. Reported by Antony Dovgal on github as https://github.com/libevent/libevent/issues/19
Nick Mathewson c17dd591 2011-07-15T11:10:54 Free dangling event_once objects on event_base_free() This patch makes us keep event_once objects in a doubly linked list so we can free any once that haven't triggered when we call event_base_free().
Nick Mathewson 56e48c10 2012-11-02T10:58:02 Fix a few mingw64 incompatibilities introduced since 2.0
Nick Mathewson 2e6a9850 2012-11-01T18:12:07 Merge remote-tracking branch 'github/20_win64_compilation' into 21_win64_compilation Conflicts: event.c http.c sample/event-read-fifo.c test/regress_bufferevent.c
Nick Mathewson 94866c27 2012-11-01T17:38:34 Compile without warnings on mingw64 This is mostly a matter of catching cases where we were still assuming that evutil_socket_t could be used as an int.
Nick Mathewson ffe1643b 2012-09-10T13:43:26 Add missing return value in event_base_foreach_event Fix for github issue nmathewson/Libevent #65 Found by Joachim Bauch
Nick Mathewson 232055ef 2012-09-07T09:58:24 Tweak patch for event_base_foreach_event() * Fix whitespace * Explain return value from callback function * Reinstate return value so that caller can tell whether forech exited early. * Rename event_base_foreach_event_() to event_base_foreach_event_nolock_(). * Use event_base_foreach_event_cb_fn typedef in more places * Be more dire about undefined behavior.
Roman Puls 84fd6d75 2012-09-07T09:47:50 Expose event_base_foreach_event() as a public API.
Nick Mathewson 6c14d564 2012-07-16T15:44:07 Merge remote-tracking branch 'origin/patches-2.0' Conflicts: event.c win32select.c
Nick Mathewson 9cd5acb5 2012-06-28T12:00:57 Make th_base_lock nonrecursive This is necessary for making some thread libraries work with event.c, and might get better performance with others. The biggest change required here was that we needed to make some internal code that had previously called event_add and event_del call the nolock variants.
Simon Liu be7a95c6 2012-06-15T01:01:05 Make event_pending() threadsafe. (Commit message by Nick)
Nick Mathewson 7d6aa5ee 2012-05-09T12:05:07 Add an event_base_loopcontinue() to tell libevent to rescan right away
Nick Mathewson c0e425ab 2012-05-09T11:06:06 Restore our priority-inversion-prevention code with deferreds Back when deferred_cb stuff had its own queue, the queue was always executed, but we never ran more than 16 callbacks per iteration. That made for two problems: 1: Because deferred_cb stuff would always run, and had no priority, it could cause priority inversion. 2: It doesn't respect the max_dispatch_interval code. Then, when I refactored deferred_cb to be a special case of event_callback, that solved the above issues, but made for two more issues: 3: Because deferred_cb stuff would always get the default priority, it could could low-priority bufferevents to get too much priority. 4: With code like bufferevent_pair, it's easy to get into a situation where two deferreds keep adding one another, preventing the event loop from ever actually scanning for more events. This commit fixes the above by giving deferreds a better notion of priorities, and by limiting the number of deferreds that can be added to the _current_ loop iteration's active queues. (Extra deferreds are put into the active_later state.) That isn't an all-purpose priority inversion solution, of course: for that, you may need to mess around with max_dispatch_interval.
Nick Mathewson 581b5beb 2012-05-09T10:50:07 Give event_base_process_active a single exit path
Nick Mathewson c46cb9c3 2012-05-09T10:49:28 Make event_base_getnpriorities work with old "implicit base" code
Nick Mathewson f90e2559 2012-05-08T17:46:46 New event_get_priority() function to return an event's priority
Nick Mathewson a4079aa8 2012-04-06T11:05:35 Replace more deferred_cb names with event_callback
Nick Mathewson ae2b84b2 2012-04-06T04:33:19 Replace deferred_cbs with event_callback-based implementation.
Nick Mathewson fec8bae2 2012-04-06T03:15:50 event_base_assert_ok: check value of event_active_count for correctness
Nick Mathewson 745a63db 2012-04-06T03:00:40 Add "active later" event_callbacks to supersede deferred An event or event callback can now be in an additional state: "active later". When an event is in this state, it will become active the next time we run through the event loop. This lets us do what we wanted to with deferred callbacks: make a type of active thing that avoids infinite circular regress in a way that starves other events or exhausts the stack. It improves on deferred callbacks by respecting priorities, and by having a non-kludgy way to avoid event starvation.
Nick Mathewson cba59e53 2012-04-05T12:38:18 Refactor the callback part of an event into its own event_callback type This shouldn't have any visible effect, but it's necessary or advisible for a few changes and cleanups I would like to make, including: * Replacing the deferred queue with a type that works more as if it were an event. * Introducing a useful "activate this on the next round through the event loop" state for events and deferreds. * Adding an "on until further notice" status for events, to allow a saner win32-hybrid approach. * Eventually, making all user callbacks first-class things with event-like semantics.
Nick Mathewson a1630260 2012-05-01T13:22:56 Merge branch '21_robust_monotonic'
Nick Mathewson 2e882a07 2012-04-30T22:00:05 Merge remote-tracking branch 'origin/patches-2.0' Conflicts: event.c
Nick Mathewson 2bfda401 2012-04-30T17:30:48 If a higher-priority event becomes active, don't continue running events of the current priority. Bug found by Ralph Castain.
Nick Mathewson 630f077c 2012-04-26T11:56:59 Simple unit tests for monotonic timers
Nick Mathewson a2598ec6 2012-04-23T13:56:00 Add EVENT_PRECISE_TIMER environment var for selecting precise-but-slow timer
Nick Mathewson f5e4eb05 2012-04-20T13:14:10 Refactor monotonic timer handling into a new type and set of functions; add a gettimeofday-based ratcheting implementation Now, event.c can always assume that we have a monotonic timer; this makes event.c easier to write.
Nick Mathewson d992d911 2012-04-20T11:51:33 Merge remote-tracking branch 'origin/patches-2.0'
Nick Mathewson dfd808cb 2012-04-19T00:25:12 If time has jumped so we'd reschedule a periodic event in the past, schedule it for the future instead Fixes an issue reported on libevent-users in the thread "a dead looping bug when changing system time backward". Previously, if time jumped forward 1 hour[*] and we had a one-second periodic timer event, that event would get invoked 3600 times. That's almost certainly not what anybody wants. In a future version of Libevent, we should expose the amount of time that the callbac kwould have been invoked somehow. [*] Forward time jumps can happen with nonmonotonic clocks, or with clocks that jump on suspend/resume. It can also happen from Libevent's point of view if the user exits from event_base_loop() and doesn't call it again for a while.
Nick Mathewson bec22b41 2012-04-19T18:15:12 Refactor event_persist_closure: raise and extract some common logic
Nick Mathewson d5e1d5ad 2012-04-17T15:16:08 Implement a GetTickCount-based monotonic timer for Windows
Nick Mathewson 55780a70 2012-04-17T13:09:49 On Linux, use CLOCK_MONOTONIC_COARSE by default You can make it use CLOCK_MONOTONIC again by setting the EVENT_BASE_FLAG_PRECISE_TIMER flag in the event_config.
Nick Mathewson 1fbef7d5 2012-04-17T12:44:39 Move use_monotonic and friends into event_base The use_monotonic field used to be a static field set up at library setup. Unfortunately, this makes it hard to give the user a way to make speed/accuracy tradeoffs about time. Moving it into event_base should let the clock implementation become configurable.
Nick Mathewson 53a07fe2 2010-09-17T00:34:13 Replace pipe-based notification with EVFILT_USER where possible Sufficiently recent kqueue implementations have an EVFILT_USER filter that we can use to wake up an event base from another thread. When it's supported, we now use this mechanism rather than our old (pipe-based) mechanism. This should save some time and complications on newer OSX and freebsds.
Nick Mathewson cb653a00 2012-04-09T13:41:45 Do not track use_monotonic field when is no monotonic clock
Nick Mathewson b8fd6f91 2012-04-09T13:39:11 Use mach_absolute_time() for monotonic clock support on OSX.
Nick Mathewson 2449e0c5 2012-04-03T16:15:49 Fix some compilation warnings with msvc
Nick Mathewson 13dad99c 2012-04-03T14:53:00 make event_base_get_running_event build with threads disabled.
Nick Mathewson 09cbc3dc 2012-03-26T23:28:21 Temporarily disable event_queue_reinsert_timeout Apparently, now that we have tests for it in main/common_timeout, we can now see that it sometimes breaks referential integrity somehow. Since I'd like to get 2.1.1-alpha out the door soon, I'm turning it off for now.
Nick Mathewson 55e991b2 2012-03-26T17:35:21 Make libevent_global_shutdown() idempotent Two calls to libevent_global_shutdown on your exit path shouldn't result in a crash.
Nick Mathewson c5732fdd 2012-03-25T18:54:40 Add event_base_get_running_event() to get the event* whose cb we are in
Nick Mathewson 8c36acd0 2012-03-23T18:42:56 Fix a nasty bug in event_queue_reinsert_timeout() What was I thinking? The old function could handle heap-to-heap transitions, and transitions within the same common timeout queue, but it completely failed to handle heap/queue transitions, or transitions between timeout queues. Now, alas, it's complicated. I should look hard at the assembly here to see if it's actually better than the alternatives.
Nick Mathewson 0343d8fe 2012-03-23T17:53:08 event_base_dump_events: Report active events tersely, and note internal events