Closed
Bug 450224
Opened 16 years ago
Closed 16 years ago
PR_Interrupt() interrupts PR_TransmitFile() while PR_BlockInterrupt() in effect
Categories
(NSPR :: NSPR, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
4.7.2
People
(Reporter: ziegler, Assigned: wtc)
Details
Attachments
(1 file, 2 obsolete files)
1.74 KB,
patch
|
nelson
:
review+
|
Details | Diff | Splinter Review |
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.15) Gecko/20080612 Iceweasel/2.0.0.15 (Debian-2.0.0.15-0etch1) Build Identifier: 4.7.1 The summary says it. I have 5 worker threads and 1 master thread in a server application. A worker thread, after doing a PR_Accept(), immediately calls PR_BlockInterrupt() so that it can serve the request to full completion. After it has served the request, it calls PR_UnblockInterrupt() so that it can be interrupted by the worker thread issuing a PR_Interrupt() while the worker is blocking in PR_Accept(). The bug: The worker's PR_Interrupt() also interrupts the worker while it is in a PR_TransmitFile(): MASTER[11505]: Sending interrupt signal to worker threads. MASTER[11505]: Thread 0 is blocked. Sent PR_Interrupt. MASTER[11505]: Thread 1 is blocked. Sent PR_Interrupt. MASTER[11505]: Thread 2 is blocked. Sent PR_Interrupt. MASTER[11505]: Thread 3 is blocked. Sent PR_Interrupt. MASTER[11505]: Thread 4 is blocked. Sent PR_Interrupt. MASTER[11505]: Joining worker threads. oops: PR_TransmitFile in do_cat: -5993: Operation interrupted by another thread [11505] Thread 2 is shutting down. oops: PR_TransmitFile in do_cat: -5993: Operation interrupted by another thread [11505] Thread 0 is shutting down. MASTER[11505]: Thread 0 successfully joined. oops: PR_TransmitFile in do_cat: -5993: Operation interrupted by another thread [11505] Thread 3 is shutting down. oops: PR_TransmitFile in do_cat: -5993: Operation interrupted by another thread [11505] Thread 1 is shutting down. oops: PR_TransmitFile in do_cat: -5993: Operation interrupted by another thread [11505] Thread 4 is shutting down. Reproducible: Always
Assignee | ||
Comment 1•16 years ago
|
||
Joachim, Could you add some printf statements to pt_TransmitFile and the functions it calls to identify where it gets interrupted? pt_TransmitFile (in ptio.c) has several implementations, so you need to use the Linux code. If you don't have time, I'll try to give you a patch later this week.
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Version: other → 4.7.1
Reporter | ||
Comment 2•16 years ago
|
||
Hello Wan-Teh, it seems that your original instructions to replace if (self->state & PT_THREAD_ABORTED) by if (_PT_THREAD_INTERRUPTED(self)) is enough to solve the problem: I forgot to set my LD_LIBRARY_PATH to point to my own version of the NSPR shared lib, so I never run my self-compiled code, but only the NSPR as originally installed on my Debian Linux box. I'm sorry for that. Now PR_TransmitFile() si not interrupted any more. Joachim
Assignee | ||
Comment 3•16 years ago
|
||
Joachim, No problem. Glad to hear that using _PT_THREAD_INTERRUPTED(self) fixes this bug. Could you attach your patch to this bug report?
Assignee | ||
Comment 4•16 years ago
|
||
We should test the PT_THREAD_ABORTED flag using the _PT_THREAD_INTERRUPTED macro, which takes into account whether interrupts are being blocked.
Attachment #333691 -
Flags: review?(nelson)
Reporter | ||
Comment 5•16 years ago
|
||
Reporter | ||
Comment 6•16 years ago
|
||
I posted the attachment, see above. Unfortunately, I hit RETURN before I could give a detailed explanation. This patch replaces 4 times the test if (self->state & PT_THREAD_ABORTED) by if (_PT_THREAD_INTERRUPTED(self))
Comment 7•16 years ago
|
||
Joachim, Thanks for the sources. Here is your modified source in the form that bugzilla expects for patches. It is the output of cvs diff -pu5 ptio.c There appears to be a whitespace problem with it, but other than that, it fits your description. Wan-Teh, would you prefer that I review this new patch of Joachim's ?
Attachment #333723 -
Attachment is obsolete: true
Updated•16 years ago
|
Attachment #333723 -
Attachment is patch: false
Comment 8•16 years ago
|
||
Comment on attachment 333691 [details] [diff] [review] Proposed patch The two patches are identical except for whitespace and the "modeline" that is the first line of the file. Since this patch has no whitespace issues, I'm giving it r+.
Attachment #333691 -
Flags: review?(nelson) → review+
Assignee | ||
Updated•16 years ago
|
Attachment #333725 -
Attachment is obsolete: true
Assignee | ||
Comment 9•16 years ago
|
||
I checked in the patch on the NSPR trunk for NSPR 4.7.2. Checking in ptio.c; /cvsroot/mozilla/nsprpub/pr/src/pthreads/ptio.c,v <-- ptio.c new revision: 3.109; previous revision: 3.108 done
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
Target Milestone: --- → 4.7.2
You need to log in
before you can comment on or make changes to this bug.
Description
•