Zachary Anderson
0c3d73967d
VM eventhandler: Update epoll/kqueue even if the only event is an error
...
Otherwise, we may try to add an fd to epoll/kqueue when it is already
there.
Also avoid sending multiple notifications on an error.
related #24417
R=fschneider@google.com
Review-Url: https://codereview.chromium.org/2655893002 .
2017-01-25 13:50:00 -08:00
Zachary Anderson
e2220c3ea8
VM eventhandler: Read "old" event mask before it can be modified.
...
related #24417
R=johnmccutchan@google.com , kustermann@google.com
Review-Url: https://codereview.chromium.org/2635253002 .
2017-01-23 08:54:52 -08:00
Zachary Anderson
43a506bcc8
Adds some error handling to the socket implementation.
...
I'm starting to try to track down the hang in socket_test in
a call to read() on Mac. We weren't checking that the calls
to set fds non-blocking were successful, so I'll start with
adding code to do that.
This CL also fixes the GN arm android build.
R=asiva@google.com
Review URL: https://codereview.chromium.org/2495003003 .
2016-11-11 21:15:16 -08:00
Zachary Anderson
479a97b129
clang-format runtime/bin
...
R=johnmccutchan@google.com
Review URL: https://codereview.chromium.org/2480793002 .
2016-11-04 12:30:56 -07:00
Zach Anderson
581939d8b6
Retry: Fixes memory leaks in the eventhandler
...
Crashes were caused by removing from a std::map while iterating over it.
R=asiva@google.com
Review URL: https://codereview.chromium.org/2231123002 .
2016-08-10 15:20:30 -07:00
Zachary Anderson
bf085120f6
Revert: Fixes leak of duplicate command line environment strings
...
For bot crashes on Mac
Review URL: https://codereview.chromium.org/2229973002 .
2016-08-09 15:36:57 -07:00
Zachary Anderson
92abe83b26
Fixes memory leaks in the eventhandler
...
These probably only happen when the VM is going down after an unhandled
exception, but I want to fix them anyway.
R=asiva@google.com
Review URL: https://codereview.chromium.org/2228503007 .
2016-08-09 15:20:50 -07:00
Zachary Anderson
7308e58c3f
Really remove io support when dart:io is unsupported.
...
Previously we would compile in implementaitions of native calls for
IO functions that would never be used. This CL provides implementations
that throw a Dart exception if they're called by mistake. It also uses
a DART_IO_DISABLED preprocessor define to clean up the build files and
check that we're not including code we shouldn't.
R=iposva@google.com , johnmccutchan@google.com
Review URL: https://codereview.chromium.org/1839463002 .
2016-03-29 11:22:03 -07:00
Zachary Anderson
45661a7091
Cleanup in //runtime/bin
...
R=iposva@google.com
Review URL: https://codereview.chromium.org/1800863002 .
2016-03-16 10:01:00 -07:00
Ryan Macnak
2bfdde5c36
Also adjust the event handler's timer_fd to the monotonic clock.
...
Should fix timeouts on pkg-linux-debug-be.
Cf. 9387fead15 .
BUG=http://dartbug.com/25055
BUG=http://dartbug.com/25216
TBR=iposva@google.com
Review URL: https://codereview.chromium.org/1513843007 .
2015-12-11 17:37:35 -08:00
kustermann@google.com
615d1a01ac
Reland "Introduce optional 'bool shared' parameter to ServerSocket.bind() ..."
...
R=sgjesse@google.com
Review URL: https://codereview.chromium.org//913753002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43678 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-11 10:01:20 +00:00
kustermann@google.com
1c7ef3c4f2
Implement mac support for having multiple Dart_Port's registered on one OS socket
...
R=sgjesse@google.com
Review URL: https://codereview.chromium.org//908183002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43632 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-10 10:15:33 +00:00
kustermann@google.com
ebde0dbaeb
Extract common Mask/Dart_Port settings of linux event handler implementation to eventhandler.h
...
R=sgjesse@google.com , wibling@google.com
Review URL: https://codereview.chromium.org//905733002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43585 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-09 08:50:32 +00:00
kustermann@google.com
3ea331e741
Introduce a kSetEventMaskCommand, some cleanups in windows eventhandler
...
R=sgjesse@google.com
Review URL: https://codereview.chromium.org//900363004
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43547 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-06 09:36:57 +00:00
kustermann@google.com
a7f50cd5d2
Move CircularLinkedList to eventhandler.h
...
Move constants and InterruptMessage to eventhandler.h
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43524 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-05 21:45:47 +00:00
kustermann@google.com
cae03aaf1a
Wait for eventhandler to shut down before exiting
...
R=sgjesse@google.com
Review URL: https://codereview.chromium.org//875403006
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43504 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-05 13:16:07 +00:00
kustermann@google.com
1d6231bacd
Revert "Introduce optional 'bool shared' parameter to ServerSocket.bind() ..."
...
Review URL: https://codereview.chromium.org//896213002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43476 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-04 16:00:21 +00:00
kustermann@google.com
3c6c29fee9
Introduce optional 'bool shared' parameter to ServerSocket.bind() ...
...
R=sgjesse@google.com , wibling@google.com
Review URL: https://codereview.chromium.org//879353003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43467 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-04 13:41:41 +00:00
kustermann@google.com
360dfe4f41
Several bugfixes in dart:io's handing of sockets
...
This CL includes fixes for the following issues:
a) The event handler created listening socket metadata (values of a hashtable
indexed by filedescriptor) sometimes as SocketData and sometimes as
ListeningSocketData depending whether the socket has been listened to or not.
This was very buggy, in particular because multiple isolates can have a
reference to the same server socket in different states (opened, listened,
closed).
=> This should be fixed by sending the file descriptior typeMask always to the
eventhandler.
b) A server socket cloned via the ServerSocketReference mechanism, opens a
receive port for sending (fd, address, port) to isolates/... which want to
create a server socket from the reference.
This receive port was not closed properly when calling only close() (and not
listening first).
=> This should be fixed by closing this receiveport on the ServerSocket.close()
call as well.
c) It was assumed in the event handler that a close command needs to have the
Dart_Port in a hash table. But this is only the case if the user actually
listened to the ServerSocket. Otherwise the event handler does not know about
the server socket. This caused a NULL dereference which resulted in a SEGFAULT.
=> This should be fixed by checking if the Dart_Port is in the hashmap of the
ListeningSocketData or not.
d) Too many bits were considered when extracting token count in C++ code.
The CL includes a regression test which should trigger these issues.
BUG=21384,21383
R=sgjesse@google.com
Review URL: https://codereview.chromium.org//665823007
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41276 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-24 08:55:50 +00:00
iposva@google.com
5a383e7add
- Make sure that the threads for dart::bin are in the correct namespace.
...
R=asiva@google.com
Review URL: https://codereview.chromium.org//471743002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39233 260f80e4-7a28-3924-810f-c04153c831b5
2014-08-14 00:06:04 +00:00
iposva@google.com
14ecdbd66a
- Separate the thread implementation used in bin/ and vm/
...
to allow us to make VM specific changes.
R=asiva@google.com
Review URL: https://codereview.chromium.org//463993002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39172 260f80e4-7a28-3924-810f-c04153c831b5
2014-08-12 23:19:53 +00:00
ajohnsen@google.com
c7a15b7c2b
Add support for cloning server-sockets.
...
BUG=
R=lrn@google.com , sgjesse@google.com
Review URL: https://codereview.chromium.org//250513002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35818 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-06 19:09:44 +00:00
ajohnsen@google.com
8f41c24471
Make server-sockets level triggered.
...
BUG=
R=sgjesse@google.com
Review URL: https://codereview.chromium.org//234843003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35302 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-23 06:05:46 +00:00
ajohnsen@google.com
1a8f76beb3
Only return eventhandler tokens in stacks of 8, to avoid runtime calls.
...
BUG=
R=sgjesse@google.com
Review URL: https://codereview.chromium.org//208653012
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@34359 260f80e4-7a28-3924-810f-c04153c831b5
2014-03-25 13:44:01 +00:00
ajohnsen@google.com
4f613457d6
Speed up GetRandomBytes by only entering signal-blocking scope once.
...
BUG=
R=sgjesse@google.com
Review URL: https://codereview.chromium.org//209333014
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@34356 260f80e4-7a28-3924-810f-c04153c831b5
2014-03-25 13:06:37 +00:00
ajohnsen@google.com
0c157cd31e
Move signal_blocker to platform and use it by default in TEMP_FAILURE_RETRY.
...
BUG=http://code.google.com/p/dart/issues/detail?id=16927
R=johnmccutchan@google.com , sgjesse@google.com
Review URL: https://codereview.chromium.org//165723007
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@33745 260f80e4-7a28-3924-810f-c04153c831b5
2014-03-17 13:51:11 +00:00
ajohnsen@google.com
9a71498127
Make the event-handler handle backpreasure.
...
We now limit the number of active events per fd to 8.
BUG=
R=whesse@google.com
Review URL: https://codereview.chromium.org//198743002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@33649 260f80e4-7a28-3924-810f-c04153c831b5
2014-03-13 12:02:47 +00:00
ajohnsen@google.com
e87d3883b9
Fix error-checking when calling timerfd_create.
...
BUG=https://code.google.com/p/dart/issues/detail?id=17051
R=kasperl@google.com
Review URL: https://codereview.chromium.org//177643002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32960 260f80e4-7a28-3924-810f-c04153c831b5
2014-02-24 12:45:16 +00:00
sgjesse@google.com
37913b1e00
Add missing mutex protection for timeout queue with mutex
...
Holding the timer_mutex_ is required to access the timeout_queue_ data
structure. This was missing for epoll events.
R=kustermann@google.com
BUG=
Review URL: https://codereview.chromium.org//174033002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32856 260f80e4-7a28-3924-810f-c04153c831b5
2014-02-20 17:21:27 +00:00
ajohnsen@google.com
e3372e72e9
Remove SocketData and now only pass the dart port to epoll.
...
This avoids keeping extra data alive.
BUG=
R=sgjesse@google.com
Review URL: https://codereview.chromium.org//171503009
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32846 260f80e4-7a28-3924-810f-c04153c831b5
2014-02-20 08:56:54 +00:00
ajohnsen@google.com
cabe710753
Remove 'mask' from SocketData, as it's not required.
...
BUG=
R=sgjesse@google.com
Review URL: https://codereview.chromium.org//167193004
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32794 260f80e4-7a28-3924-810f-c04153c831b5
2014-02-19 16:15:00 +00:00
ajohnsen@google.com
6bbd44db73
Also make eventhandler on Android edge-triggered.
...
BUG=
R=sgjesse@google.com
Review URL: https://codereview.chromium.org//172133004
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32791 260f80e4-7a28-3924-810f-c04153c831b5
2014-02-19 13:29:13 +00:00
ajohnsen@google.com
140fddd06e
Make event-handlers edge-triggered and move socket-state to Dart.
...
This eliminates to pause/resume calls made in the previous one-shot based model.
BUG=
R=sgjesse@google.com
Review URL: https://codereview.chromium.org//169383003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32780 260f80e4-7a28-3924-810f-c04153c831b5
2014-02-19 09:44:26 +00:00
ajohnsen@google.com
0f52be7f63
Make std* blocking file-descriptors.
...
This will most likely be a performance regression when piping, that
we'll have to look into in the future (copying data through
message-passing).
BUG=
R=sgjesse@google.com
Review URL: https://codereview.chromium.org//154273003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32715 260f80e4-7a28-3924-810f-c04153c831b5
2014-02-17 10:06:35 +00:00
ajohnsen@google.com
69d20ad7d3
Don't make timerfd non-blocking and add errno to error-mesage.
...
BUG=
R=sgjesse@google.com
Review URL: https://codereview.chromium.org//107143005
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@31162 260f80e4-7a28-3924-810f-c04153c831b5
2013-12-16 14:48:33 +00:00
ajohnsen@google.com
9a8edb6924
Use timerfd to handle timeouts on Linux.
...
BUG=
R=sgjesse@google.com
Review URL: https://codereview.chromium.org//104803005
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@30884 260f80e4-7a28-3924-810f-c04153c831b5
2013-12-05 09:22:07 +00:00
ajohnsen@google.com
2b83a250a5
Fix re-adding to epoll, when event is unhandled.
...
BUG=
Review URL: https://codereview.chromium.org//83483003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@30576 260f80e4-7a28-3924-810f-c04153c831b5
2013-11-22 13:56:40 +00:00
ajohnsen@google.com
c98d0bde22
Read up to 8 InterruptMessages at a time, in unix eventhandlers.
...
BUG=
R=sgjesse@google.com
Review URL: https://codereview.chromium.org//83173003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@30574 260f80e4-7a28-3924-810f-c04153c831b5
2013-11-22 12:50:29 +00:00
ajohnsen@google.com
d2e3c3d573
Limit the number of syscalls made by the Eventhandler.
...
We now let epoll use EPOLLONESHOT instead of manual unsubscribing, and
only to handle timeouts when no IO events was received.
BUG=
R=sgjesse@google.com
Review URL: https://codereview.chromium.org//82873002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@30566 260f80e4-7a28-3924-810f-c04153c831b5
2013-11-22 08:24:40 +00:00
ajohnsen@google.com
ff5f4fbdc9
Only read from interrupt_fd when data is available.
...
BUG=
R=sgjesse@google.com
Review URL: https://codereview.chromium.org//77983002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@30453 260f80e4-7a28-3924-810f-c04153c831b5
2013-11-20 10:26:59 +00:00
ajohnsen@google.com
c6ef82b5c9
Polish the EventHandler cleanup in r26517.
...
BUG=
R=iposva@google.com , sgjesse@google.com
Review URL: https://codereview.chromium.org//22918023
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27386 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-11 15:31:44 +00:00
ajohnsen@google.com
3dfe7c97e2
Always initialize the EventHandler in the standalone.
...
BUG=
R=sgjesse@google.com
Review URL: https://codereview.chromium.org//22901017
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26517 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-22 12:03:59 +00:00
jacobr@google.com
605b33c1bc
fix cpp11 compile errors
...
R=asiva@google.com
Review URL: https://codereview.chromium.org//23072026
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26387 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-20 20:24:11 +00:00
cbracken@google.com
a6ace331f3
Replaced strerror() calls with threadsafe strerror_r().
...
Mac/Android use the XSI-compliant definition of strerror_r() which stores the message in the passed-in buffer.
Linux uses the GNU-specific definition of strerror_r() which takes a buffer and returns the message in a char* (which may or may not be the passed-in buffer).
BUG=
R=iposva@google.com
Review URL: https://codereview.chromium.org//22634003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25943 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-08 20:24:05 +00:00
ajohnsen@google.com
2bd55c23c7
Keep track of when a socket has been destroyed
...
This adds the event CLOSED to RawSocket and RawServerSocket. This
event indicate that the underlying socket is now destroyed.
This is used to make Socket.close and ServerSocket.close return a
future which is completed when the unserlying socket is
destroyed. This can be used to start listening on the same port after
closing a server socket.
R=ajohnsen@google.com , kustermann@google.com
BUG=https://code.google.com/p/dart/issues/detail?id=4155
Review URL: https://codereview.chromium.org//14864009
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25213 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-19 13:26:48 +00:00
ajohnsen@google.com
1e2289e275
One event ahndler for all isolates
...
BUG=
R=whesse@google.com
Review URL: https://codereview.chromium.org//17851004
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25082 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-17 07:26:05 +00:00
ajohnsen@google.com
d506a6e490
Stop printing when stdout is closed.
...
This makes sure we don't print(...) data to a file opened after stdout
was closed.
BUG=https://code.google.com/p/dart/issues/detail?id=9615
R=kustermann@google.com , whesse@google.com
Review URL: https://codereview.chromium.org//18031003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24525 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-27 16:44:39 +00:00
sgjesse@google.com
89a21f2479
Change the timeout handling in the standalone VM to use 64-bit integers
...
R=floitsch@google.com
BUG=
Review URL: https://codereview.chromium.org//17878002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24466 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-26 13:33:10 +00:00
smok@google.com
ebbc2020a2
Put everything in runtime/bin into '::dart::bin' namespace.
...
Review URL: https://codereview.chromium.org//14341015
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@22032 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-25 14:22:30 +00:00
ager@google.com
26c4b3a58d
Fix file descriptor leak in event handler implementation. When shutting down an isolate, we did not destruct the eventhandler so we leaked the file descriptors for it.
...
Also fix leak of monitor wait data objects on Windows.
R=sgjesse@google.com
BUG=dartbug.com/9021
Review URL: https://codereview.chromium.org//12646007
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@19921 260f80e4-7a28-3924-810f-c04153c831b5
2013-03-13 11:11:38 +00:00