File descriptors registered with FileDescriptorWatcher POSIX cannot be safely close()d |
|||||
Issue descriptionThe FileDescriptorWatcher POSIX wrapper is used by code running on TaskScheduler to watch for when file descriptors are readable/writable, on a dedicated I/O thread. The API has two issues in its current form: 1. It is not possible for calling code to protect against raciness when close()ing watched file-descriptors: a. The underlying WatchFileDescriptor call may be passed an invalid file-descriptor. b. The file-descriptor may be closed, and re-used, by the time WatchFileDescriptor executes, leading to the wrong file being watched. 2. The API provides no indication to the caller of whether the watch succeeded or failed: a. This makes it harder to diagnose brokenness in the underlying MessagePump*::FileDescriptorWatcher (see issue 740305 ). b. This makes it harder to spot brokenness in production & test code via unit-tests (see issue 740692 ). #2 cannot be resolved without addressing #1, since there is currently no mechanism to provide the required synchronization. For the wrapper to be safe, it should "own" the file-descriptors it watches, or the caller should be required to pass them to the FDW to be closed, rather than doing so itself.
,
Jul 17 2017
wez: is something already working on this?
,
Jul 17 2017
s/something/someone/
,
Jul 17 2017
Re #3: Not that I'm aware of, no; our plan was to meet w/ fdoray@ to discuss potential fixes to the FDW design to address these issues. Are you volunteering to work on that? :)
,
Jul 24 2017
No, I'm not volunteering :) Just trying to do bug triage. Do you anticipate the solution for Mac to be different from iOS'?
,
Jul 24 2017
Re #5: The FileDescriptorWatcher POSIX wrapper is used across all the POSIX-ish platforms, so no there is nothing Mac vs iOS specific here.
,
Aug 7 2017
robliao: is this something in your area?
,
Aug 7 2017
fdoray: Would be a good initial triager for this.
,
Sep 12 2017
Can an update be posted to this bug please? It is a P1 that was targeted for M61.
,
Sep 12 2017
,
Oct 2 2017
Tentative fix at https://chromium-review.googlesource.com/c/chromium/src/+/695914
,
Jan 7
What's the plan for the tentative fix?
,
Jan 21
(2 days ago)
|
|||||
►
Sign in to add a comment |
|||||
Comment 1 by w...@chromium.org
, Jul 11 2017