Closed Bug 288232 Opened 20 years ago Closed 20 years ago

calling PR_Interrupt on WINNT corrupts the NSPR threads

Categories

(NSPR :: NSPR, defect)

x86
Windows NT
defect
Not set
normal

Tracking

(Not tracked)

VERIFIED INVALID

People

(Reporter: glenbeasley, Assigned: wtc)

Details

Calling PR_Interrupt on WINNT will corrupt the NSPR threads. 

I created a JSS client server test case that has a client reader 
thread block, and the client then has a thread attempt to close 
the socket by calling PR_Interrupt to unblock the reader, and 
then close the socket. 
After calling Pr_Interrupt the reader is unblocked, and the socket 
is often allowed to close but at exit of the program nspr crashes 
with the following stack:
_PR_MD_PAUSE in ntio.c 
_PR_CPU_Idle 
_PR_UserRunThread
_pr_fiber_mainline

If you set NPSR_NATIVE_THREADS_ONLY=1 then there is no issue using PR_Interrupt 
since NT fibers are not used with the enviroment variable is set. 
Related NSPR bug is 282496.
As I noted in bug 282732 comment 9, I believe this
crash is caused by the combination of two programming
errors.

1. The interrupted thread needs to call PR_NT_CancelIo
before returning from socketRead and socketWrite.

2. The synchronization in SSLSocket.close is not
quite right.  After it calls abortReadWrite, it
needs to wait until ioRead and ioWrite are both
false.
Summary: calling PR_Interrupt on WINNT corrupts the NSPR threads → calling PR_Interrupt on WINNT corrupts the NSPR threads
closing bug, due to my user error.

if interrupted thread calls PR_NT_CancelIo, there is no corruption. 


Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → INVALID
Glad to hear that's indeed the problem.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.