Commit graph

600 commits

Author SHA1 Message Date
Sönke Ludwig 14a896be5d Attempt to fix crash in thread based DNS lookup.
Depending on the timing of starting and finishing DNS queries, `Thread.join` could be called on an instance that had already been `destroy`ed. To avoid this, the thread instance is now explicitly set to null, as well as resetting the "done" field to avoid redundant work for unused slots.

See vibe-d/vibe.d#2378.
2019-10-25 09:27:22 +02:00
Sönke Ludwig f6ac56664d Add API documentation links to README. 2019-10-08 21:26:43 +02:00
The Dlang Bot 38536e0be9
Merge pull request #126 from Geod24/suppert
Update list of compilers to match vibe-core
merged-on-behalf-of: Sönke Ludwig <s-ludwig@users.noreply.github.com>
2019-10-08 21:25:41 +02:00
Sönke Ludwig 8a4dc304dd
Fix missing build config. 2019-10-08 19:21:54 +02:00
Sönke Ludwig 9357cf485f
Merge pull request #130 from vibe-d/issue_vibed_2378_dns_lookup_memory_leak
Start a thread for each DNS lookup
2019-10-08 16:22:29 +02:00
Sönke Ludwig b77adfcbd2 Add proper thread synchronization to EventDriverDNS_GAI. 2019-10-07 11:18:58 +02:00
Sönke Ludwig 5255645455 Start a thread for each DNS lookup. Fixes vibe-d/vibe.d#2378.
std.parallelism.Task.executeInNewThread leaks the thread's resources instead of reusing it in later calls. As a workaround, this commit starts a new thread for every lookup and properly tears it down afterwards. At a later point, this code should be changed to reuse the thread(s), if possible, to avoid the startup overhead.
2019-10-07 11:10:21 +02:00
Sönke Ludwig f38a8cdb5a
Merge pull request #129 from kubo39/remove-unused-safeYield-function
Remove unused function `safeYield`
2019-09-26 19:12:26 +02:00
Hiroki Noda 4aa6420662 Remove unused function safeYield 2019-09-26 20:33:05 +09:00
Benjamin Schaaf 782fc40152 Add MSG_NOSIGNAL flag to send call to avoid SIGPIPE (#128)
Add MSG_NOSIGNAL flag to send call to avoid SIGPIPE
merged-on-behalf-of: Sönke Ludwig <s-ludwig@users.noreply.github.com>
2019-09-06 19:15:30 +02:00
Geod24 312f49ce65 Remove outdate comments for unsupported compilers 2019-09-03 02:10:02 +09:00
Geod24 86cb50bfd2 Update list of supported compiler to match vibe-core 2019-09-03 01:55:21 +09:00
Sönke Ludwig bca94d5736
Merge pull request #122 from vibe-d/fix_zombie_processes
Use waitpid to iterate over all exited child processes
2019-08-24 00:38:15 +02:00
Sönke Ludwig 20373d10db Fix indentation and remove unused imports/variables. 2019-08-23 19:55:55 +02:00
Sönke Ludwig 5c3afcc175 Ensure that a valid PID is passed to kill(). 2019-08-23 09:35:13 +02:00
Sönke Ludwig 01c2c26964 Fix Windows compilation.
Integrates the contents of StaticProcesses into PosixEventDriverProcesses to fully hide it form the Windows build. It also changes lockedProcessInfo to be a non-template function, as that lead to a linker error on macOS.
2019-08-23 09:35:13 +02:00
Sönke Ludwig f1c2eb779f Use the Posix process driver on all Posix operating systems. 2019-08-23 09:35:13 +02:00
Sönke Ludwig 7ebad49ed0 Rework the child process exit code to not rely in SIGCHLD.
It turns out that in a heterogeneous process where other parts of the code may start processes or threads and may be waiting for those to finish, it is not realistic to rely on signalfd or even SIGCHLD in general to get notified about child process exits. The only solid way appears to be to start a separate waiter thread that uses waitid/waitpid to wait for exited child processes in a blocking way.

This also fixes the hanging vibe.core.process test in vibe-core with DMD 2.087.x.
2019-08-23 09:35:12 +02:00
Sönke Ludwig 1ef320c329 Use a more robust way to self-execute the test binary. 2019-08-23 09:35:12 +02:00
Sönke Ludwig 4724f14145 Avoid interference with other users of waitpid.
Instead of using waitpid(-1), explicitly waits on all known processes. This is inefficient for large numbers of child processes, but seems to be the only way to ensure to not interfere with other code that uses waitpid().
2019-08-23 09:35:12 +02:00
Sönke Ludwig 72234fc0a7 Return an invalid wait ID for processes.wait() if the process has already exited.
Avoids overlap with valid wait IDs, so that a paired cancelWait() doesn't cancel a different wait.
2019-08-23 09:35:12 +02:00
Sönke Ludwig de199d3410 Add test for SIGCHLD coalescing. 2019-08-23 09:35:12 +02:00
Sönke Ludwig 507fb5a0c9 Use waitpid to iterate over all exited child processes. Fixes #116. Closes #117. 2019-08-23 09:35:12 +02:00
Sönke Ludwig e1c6d99798 Fix indentation style. 2019-08-23 09:35:11 +02:00
The Dlang Bot e23090b513
Merge pull request #123 from vibe-d/update_compiler_support
Test up to DMD 2.087.1/LDC 1.16.0.
merged-on-behalf-of: Sönke Ludwig <s-ludwig@users.noreply.github.com>
2019-08-23 09:15:31 +02:00
Sönke Ludwig 86b737968b Test up to DMD 2.087.1/LDC 1.16.0.
Drops all but the latest 4 versions and the oldest supported version (2.076.1) to avoid increasing CI pressure.
2019-08-22 23:40:01 +02:00
Sönke Ludwig 8c9b5e8ac2
Merge pull request #120 from calebccff/master
Fix #119
2019-08-21 09:24:25 +02:00
Caleb Connolly c2e55122bf
Fix #119
Added missing import to fix `undefined identifier intptr_t`
2019-08-20 17:43:25 +00:00
Sönke Ludwig fbcdf98093
Merge pull request #118 from vibe-d/fix_polling_watcher_crash
Fix possible access of freed directory watcher entries.
2019-08-20 18:40:16 +02:00
Sönke Ludwig 9bb6be87c3 Fix possible access of freed directory watcher entries.
This mainly affected macOS, which currently uses the polling directory watcher. Since entries were freed during the loop, the remaining keys could point to already freed entries.
2019-08-19 23:59:11 +02:00
Sönke Ludwig cf33c3d859
Merge pull request #112 from BenjaminSchaaf/socket-fix
Fix socket not being in a connected state after connectStream
2019-08-17 14:44:48 +02:00
Sönke Ludwig 2d0fd8b1e6
Merge pull request #115 from v1ne/win-fix-appending-to-file
winapi/files: Append to files with FILE_APPEND_DATA
2019-08-17 14:29:14 +02:00
Sönke Ludwig a1b1805056
Merge pull request #114 from BenjaminSchaaf/processes-fix
Proposed fix for processes in multi-threaded environments
2019-08-17 14:28:31 +02:00
v1ne c2708f1de8 winapi/files: Append to files with FILE_APPEND_DATA
Before, the mode GENERIC_WRITE was used. This tells Windows to not
append to the file, but overwrite it normally. This is not the intended
semantics. FILE_APPEND_DATA does what we want.
2019-07-25 23:56:04 +02:00
Benjamin Schaaf 4d71b62507 Fix crash when subprocess was not spawned by eventcore 2019-07-22 10:55:45 +10:00
Benjamin Schaaf a8cd897df7 Proposed fix for processes in multi-threaded environments 2019-07-21 20:43:06 +10:00
Benjamin Schaaf 472321f1f5 Fix socket not being in a connected state after connectStream 2019-07-17 23:12:59 +10:00
Sönke Ludwig e7bf50ea2d
Merge pull request #110 from BenjaminSchaaf/process
Fix pipe writing
2019-06-02 09:13:26 +02:00
The Dlang Bot 4194edb98a
Merge pull request #111 from vibe-d/polling_watcher_refactor
Separate the polling logic of PollEventDriverWatchers into a separate class
merged-on-behalf-of: Leonid Kramer <l-kramer@users.noreply.github.com>
2019-06-02 09:12:43 +02:00
Sönke Ludwig 2a6488a101 Fix test to allow the directory watcher to start up. 2019-06-01 21:44:20 +02:00
Sönke Ludwig 731936ce9e Separate the polling logic of PollEventDriverWatchers into a separate class.
Allows to keep thread-local state separate from the mutex-protected/immutable state in PollingThread to make sure that there are no unwanted accesses.
2019-05-30 11:33:04 +02:00
Benjamin Schaaf 9a09e42802 Fix pipe writing 2019-05-05 14:31:12 +10:00
The Dlang Bot 83310fda70
Merge pull request #109 from vibe-d/fixes
Threading fixes
merged-on-behalf-of: Leonid Kramer <l-kramer@users.noreply.github.com>
2019-04-13 22:17:24 +02:00
Leonid Kramer a0cef63b5d
Merge pull request #108 from vibe-d/watcher_allocation
Use Mallocator for Win32 file system watcher buffer
2019-04-13 20:49:28 +02:00
Sönke Ludwig 78db7c9573 Fix race-condition in ThreadedFileEventDriver.
The m_files field was accessed from the worker threads, which is unsafe, because the chunk index of the ChoppedVector could change at any time. The accessed field is now copied to the worker thread instead.

Also, instead of a custom spin lock, StaticTaskPool now uses a normal Mutex, which is just as fast, but emits the proper memory barriers and is integrated with LDC's thread sanitizer.
2019-04-13 18:27:23 +02:00
Sönke Ludwig 48d083b20f Fix possible race condition in PosixEventDriverEvents.trigger.
Accessing the event slot should only be done from the owner thread, since the chunk index of the ChoppedVector could be updated at any time. Instead of a triggerAll field, this flag is now propagated through the underlying eventfd/socket pair.
2019-04-13 18:27:23 +02:00
Sönke Ludwig 9feccbe537 Fix missing nogc annotations for userData accessors.
User data only compiled successfully for sockets before this change.
2019-04-13 17:25:47 +02:00
Sönke Ludwig 304de7a39a Use Mallocator for Win32 file system watcher buffer.
Avoids allocating using the GC, which `theAllocator` points to by default.
2019-04-09 18:23:24 +02:00
Leonid Kramer 1bbe244196
Merge pull request #107 from vibe-d/disable_so_addr
Add `StreamListenOptions.reuseAddress`.
2019-04-01 20:38:29 +02:00
The Dlang Bot b11936e4bc
Merge pull request #100 from BenjaminSchaaf/process
Add APIs for working with Subprocesses and Pipes
merged-on-behalf-of: Sönke Ludwig <s-ludwig@users.noreply.github.com>
2019-04-01 14:48:41 +02:00