Commit graph

509 commits

Author SHA1 Message Date
Sönke Ludwig b6b32f4a49 Fix leaked eventfd in PosixEventDriverCore.
The leak occurred once per thread, which showed up in conjunction with DNS lookups in particular, as a thread is currently created for each lookup.
2018-03-14 21:59:42 +01:00
Sönke Ludwig 4192d31716 Create the event object in ThreadedFileEventDriver lazily.
Avoids creating event objects for every worker thread, even if never used.
2018-03-14 21:39:54 +01:00
Sönke Ludwig 02de8341aa Call the callback on connectStream socket creation failure.
The callback must *always* be called at some point, because the generic async->sync logic in vibe-core otherwise has no way to know whether to expect a callback or not.
2018-03-14 20:43:40 +01:00
Sönke Ludwig 0044946413
Merge pull request #62 from vibe-d/fix_winapi_watcher_shutdown
Fix cleanup code for directory watchers in the WinAPI driver.
2018-03-14 19:11:53 +01:00
Sönke Ludwig 53bb8eeead Fix cleanup code for directory watchers in the WinAPI driver.
- Fixes an assertion triggered by accessing a file field in releaseRef

- Fixed a potential leak of file system watcher handles when calling releaseRef from inside the supplied callback - this was the reason why the fixed assertion error wasn't triggered by the test code
2018-03-14 16:39:57 +01:00
The Dlang Bot 574de0760d
Merge pull request #59 from vibe-d/github_dub_download
Download DUB 1.8.0 from GitHub instead of code.dlang.org.
merged-on-behalf-of: Sönke Ludwig <s-ludwig@users.noreply.github.com>
2018-03-12 19:27:17 +01:00
Sönke Ludwig 7a43468bbd Download DUB 1.7.2 from GitHub instead of code.dlang.org. 2018-03-12 12:57:39 +01:00
Sönke Ludwig 3d7cf5744c
Merge pull request #61 from vibe-d/remove_obsolete_events
Fix issues in the WinAPI driver
2018-03-12 00:00:10 +01:00
Sönke Ludwig a681fc988b
Merge pull request #60 from vibe-d/single_file_taskpool
Use a single thread pool for all threaded file driver threads.
2018-03-11 23:36:34 +01:00
Sönke Ludwig f094b3934b Make sure that no obsolete I/O events get processed.
Removes overlapped I/O events when a handle gets closed prematurely (before all events have been processed) to avoid potential range violation errors as a consequence.
2018-03-11 20:32:32 +01:00
Sönke Ludwig 26907c7489 Fix set up of OVERLAPPED struct for files. 2018-03-11 20:31:44 +01:00
Sönke Ludwig 3090bc2c7c Implement filterPending for ConsumableQueue. 2018-03-11 20:31:44 +01:00
Sönke Ludwig bcf178ef98
Merge pull request #58 from vibe-d/nogc_assert
Use a custom nogc_assert in cleanup code.
2018-03-11 20:30:50 +01:00
Sönke Ludwig f5f64ee476 Use a single thread pool for all threaded file driver threads.
This avoids multiplying the number of threads by 5 for each thread that performs file I/O.
2018-03-11 14:46:55 +01:00
Sönke Ludwig df78af96bb Use a custom nogc_assert in cleanup code.
Unfortunately the built-in assert GC allocates an exception, which means that if called directly or indirectly form a finalizer, the assertion will not become visible and instead an InvalidMemoryOperationError is thrown.

This implements a custom nogc_assert() function that directly prints the assertion message and uses abort() to end the process.
2018-03-11 13:56:10 +01:00
Sönke Ludwig acc35e1107
Merge pull request #57 from vibe-d/fix_windows_completion_routines
Call Windows IO callbacks outside of completion routines.
2018-03-11 12:03:13 +01:00
Sönke Ludwig 9dc8b796e5 Get rid of OVERLAPPED_FILE.
The hEvent member is currently unused for files. Using it for the file handle makes the OVERLAPPED_CORE struct sufficient.
2018-03-11 00:27:14 +01:00
Sönke Ludwig 0e1d74cc41 Call Windows IO callbacks outside of completion routines.
Calling WinSock functions from inside of a completion routine results in undefined behavior, because the completion routine may be triggered within another WinSock function that enters an alertable wait state. For this reason, none of the callbacks that are triggered by overlapped I/O may be invoked directly from a completion routine.

To solve this, a ConsumableQueue is filled with all completion events that occur and is processed after each MsgWaitForMultipleObjectsEx call.
2018-03-10 22:59:21 +01:00
Sönke Ludwig cdbd8b58e8
Merge pull request #55 from vibe-d/issue_54_accept_state
Fix connection state after accept in the WinAPI driver
2018-03-07 11:43:58 +01:00
Sönke Ludwig 0b02c84b2b Set ConnectionState.connected when accepting a connection. Fixes #54. 2018-03-07 11:00:03 +01:00
Sönke Ludwig d15e78a517 Test for proper connection state after a successful accept/connect.
Test for #54.
2018-03-07 10:59:31 +01:00
Sönke Ludwig 008163e913 Fix setTCPNoDelay/setKeepAlive and add assertions.
Assertions make sure that socket query functions are not called with an invalid handle (resulting in strange out-of-memory errors).
2018-03-07 10:52:01 +01:00
Sönke Ludwig 43ef41d4fa Fix deprecation warning on DMD 2.079.0. 2018-03-06 20:09:03 +01:00
Sönke Ludwig 8242fd058e
Merge pull request #53 from vibe-d/fix_winapi_handles
Fix WinAPI issues
2018-03-03 20:51:10 +01:00
Sönke Ludwig 3d2a2656bb Robustness fix for WinAPIEventDriverWatchers.
Under certain (rare) circumstances, the receive buffer contains data from a file instead of the expected FILE_NOTIFY_INFORMATION structure. No signs of handle or buffer reuse could be found, so the cause for this remains unclear. Until the cause can be narrowed down, this keeps the issue visible while avoiding to crash the application.
2018-03-03 20:04:51 +01:00
Sönke Ludwig fbd6927377 Improve robustness of file I/O callbacks for the WinAPI driver.
Explicitly gets the read/write slot from the handle map from within the callback instead of dereferencing the pointer assigned when starting the operation. This makes sure that no dangling reference is accessed. Instead, if the slot got reused before the callback is invoked (which is a bug), an assertion will be triggered if the slot now has a different handle type.
2018-03-03 19:56:54 +01:00
Sönke Ludwig 3a52e0f362 Fix cast from HANDLE to descriptor in the WinAPI driver.
Avoids truncation to 32-bit for 64-bit builds. Also improves robustness of the directory watcher shutdown procedure.
2018-03-03 19:56:54 +01:00
Sönke Ludwig 79226e2c60
Merge pull request #52 from vibe-d/update_compiler_support
Update compiler support.
2018-03-03 19:55:06 +01:00
Sönke Ludwig 2fc7132829 Exclude LDC 1.4.0/macOS. 2018-03-03 19:50:57 +01:00
Sönke Ludwig 944ebf5ea9 Adjust for changed LDC download URLs. 2018-03-03 19:34:27 +01:00
Sönke Ludwig 27a80b6e0a Add DMD 2.079.0 support. 2018-03-03 18:40:36 +01:00
Sönke Ludwig 446e96fff3 Ignore DMD 2.072.2 build errors caused by old DUB version. 2018-03-03 18:19:56 +01:00
Sönke Ludwig 4bcf113732 Update compiler support.
Drops 2.071.2 and adds 2.078.3.
2018-03-03 18:02:26 +01:00
Sönke Ludwig e8e8f85271 Add DatagramSocket.broadcast property. Fixes #47. 2018-02-22 02:08:09 +01:00
Sönke Ludwig b2b072dd80 Reduce the number of ChoppedVector index operations. 2018-02-22 01:58:49 +01:00
Sönke Ludwig 30f614a7ff
Merge pull request #50 from vibe-d/fix_watcher_cancellation
Fix watcher cancellation
2018-02-22 01:56:13 +01:00
Sönke Ludwig e9df91f450
Merge pull request #48 from dkgroot-dlang/master
Fix compilation on DragonFlyBSD
2018-02-22 01:56:04 +01:00
Sönke Ludwig 0e7091d085 Fix invalid watcher slot access in the win32 driver.
The underlying file handle and the associated slot could previously be destroyed before the I/O callback had been finally called. Now the callback itself is responsible to destroying the handle.
2018-02-22 01:14:31 +01:00
Sönke Ludwig c8f95f324b Enable canceling win32 file I/O.
The CancelIOEx call was disabled just due to historical reasons.
2018-02-22 01:12:13 +01:00
Diederik de Groot 41312a589e
Remove static compiler __VERSION check. "import core.sys.dragonflybsd.netinet.in_" will work, when compiler support is there.
[See](https://github.com/vibe-d/vibe.d/pull/2028#discussion_r161077152)
2018-01-11 10:40:37 +01:00
Diederik de Groot e062e44f1c
Fix compilation on DragonFlyBSD 2018-01-09 15:23:23 +01:00
Sönke Ludwig 97b154048d
Merge pull request #46 from vibe-d/more_cloexec
Set O_CLOEXEC on the remaining FDs that are created by eventcore.
2017-12-20 01:55:14 +01:00
Sönke Ludwig 6e2938297b Set O_CLOEXEC on the remaining FDs that are created by eventcore. 2017-12-19 22:10:14 +01:00
Sönke Ludwig 324338205b
Merge pull request #45 from kubo39/efd-cloexec
Set EFD_CLOEXEC
2017-12-19 10:45:11 +01:00
Hiroki Noda 214382dcb5 Set EFD_CLOEXEC
Add missing one.
2017-12-19 13:38:47 +09:00
The Dlang Bot 94028e56dd
Merge pull request #44 from vibe-d/cloexec
Set O_CLOEXEC on socket descriptors
merged-on-behalf-of: Sönke Ludwig <s-ludwig@users.noreply.github.com>
2017-12-18 17:35:18 +01:00
Sönke Ludwig 8528b4ec00 Fix accidental resetting of O_NONBLOCK and set O_CLOEXEC on outgoing sockets, too. 2017-12-18 14:07:38 +01:00
Sönke Ludwig 50fe0b28b5 Add watchdog timer and log output to flaky test. 2017-12-18 14:06:58 +01:00
Hiroki Noda 1179163150 Add O_CLOEXEC for some posix platform 2017-12-18 09:44:08 +01:00
Hiroki Noda b252c97012 Set close-on-exec flag to prevent fd leakage for command execution 2017-12-18 09:44:08 +01:00