[PATCH 1/4] server: Move completion from async object to async queue.

Alexandre Julliard julliard at winehq.org
Mon Jun 4 15:18:59 CDT 2012


"Erich E. Hoover" <ehoover at mymail.mines.edu> writes:

> Well, maybe I screwed something up - but when I tried to access the
> descriptor like that it caused segfaults in some of the tests.  What I
> found was that neither create_async_queue or create_async increment
> the refcount on the file descriptor, but create_async does increment
> the refcount on the async queue so that the async queue will live
> throughout the life of the async.  So, what appeared to happen is
> this:
> 1) A file descriptor is created.
> 2) An async operation is queued on the file descriptor.
> 3) The file descriptor is closed (queuing the async to wake up and
> contact user space).
> 4) The file descriptor is destroyed because its refcount reaches zero.
> 5) The async operation returns from user space with completion
> information for the operation.
> 6) Accessing the completion from the no-longer existing file
> descriptor causes a crash.
>
> I tried having the async and/or the async queue increment the refcount
> for the file descriptor, but that caused a host of other problems
> (mainly file descriptors never closing).  So, I'm pretty sure that the
> completion information needs to be held separately in the async queue
> - but I can go back and double check that this is the case if you'd
> like.

It may have to be moved to the queue upon shutdown when the file
descriptor is released, but I don't see any reason to maintain two
copies of the same information.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list