thread of AcceptEx pending asynchronous operation is closed before operations complete

19 views
Skip to first unread message

Mos Yud

unread,
Jul 25, 2017, 7:41:53 AM7/25/17
to grpc.io
,Hi

.I am using GRPC 1.4.0 on windows

:According the code, accepting new connection goes like this

:Thread1
...
closure_exec_thread_func
Listen
AcceptEx with ovelapped

the sockets are associated with g_iocp.


thread 2:
...
grpc_iocp_work
GetQueuedCompletionStatus


.thread 2 might be executed after thread 1 is terminated
:according to msdn reference about acceptex

Note   All I/O initiated by a given thread is canceled when that thread exits. For overlapped sockets, pending asynchronous operations can fail if the thread is closed before the operations complete. See ExitThread for more information.

.When activating AcceptEx at thread 1, it creates pending asynchronous operations
At thread 2 we query for information regarding this pendin io operation.

?Shouldnt there be a problem with this flow

I do know that such a flow (Thread 1: assynchronous accept exit, Thread 2: GetQueuedCompletionStatus) might cause a problem in windows XP

Thx,
Moshe.


 

Nicolas Noble

unread,
Jul 25, 2017, 4:04:30 PM7/25/17
to Mos Yud, grpc.io
Which scenario have you identified that leads to a thread exiting ?

--
You received this message because you are subscribed to the Google Groups "grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grpc-io+unsubscribe@googlegroups.com.
To post to this group, send email to grp...@googlegroups.com.
Visit this group at https://groups.google.com/group/grpc-io.
To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/355d3217-9d13-43a0-807b-1d23f72ac46d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Mos Yud

unread,
Jul 25, 2017, 5:42:26 PM7/25/17
to grpc.io, mos...@gmail.com
. I activate a server with no clients. The server invoke AcceptEx (on a seperate thread), and returns immediatelly with ERROR_IO_PENDING.  
  On another thread (worker thread), there is a call to GetQueueStatusComplete from grpc_iocp_work.
  grcp_iocp_work is invoked periodically, and its also invoked after AcceptEx thread has completed.

Moshe.

בתאריך יום שלישי, 25 ביולי 2017 בשעה 23:04:30 UTC+3, מאת Nicolas Noble:
To unsubscribe from this group and stop receiving emails from it, send an email to grpc-io+u...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages