TestCookie crashes in NSPR logging

RESOLVED WORKSFORME

Status

()

--
critical
RESOLVED WORKSFORME
17 years ago
7 years ago

People

(Reporter: timeless, Unassigned)

Tracking

Trunk
x86
All
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(URL)

Attachments

(3 attachments, 2 obsolete attachments)

(Reporter)

Description

17 years ago
cvs builds from today on QNX6.0a and FreeBSD4.4

my qnx build has dll debugging output in it, and my freebsd build has xpconnect,
below is the freebsd output, which is at least vaguely interesting

./run-mozilla.sh -g -d gdb51 ./TestCookie
(gdb) run
Starting program: /home/timeless/mozilla/obj-xlib-i386-unknown-freebsd4.4/dist/bin/./TestCookie
OSREV: Undefined variable.
Type Manifest File: /home/timeless/mozilla/obj-xlib-i386-unknown-freebsd4.4/dist/bin/components/xpti.dat
warning: property switchskins already exists
warning: property switchskinstitle already exists
setting cookie for "http://www.blah.com" : "myCookie=yup; path=/" was set.
retrieving cookie(s) for "http://www.blah.com" : FOUND: myCookie=yup
retrieving cookie(s) for "http://www.blah.com/testPath/testfile.txt" : FOUND: myCookie=yup
setting cookie for "http://blah/path/file" : "aaa=bbb; path=/path" was set.
retrieving cookie(s) for "http://blah/path" : FOUND: aaa=bbb
retrieving cookie(s) for "http://blah/2path2" : NOT-FOUND
setting cookie for "http://www.netscape.com/" : "cookie=true; domain=bull.com;" was set.
retrieving cookie(s) for "http://www.bull.com/" : NOT-FOUND
setting cookie for "http://www.netscape.com/" : "cookie=true; domain=netscape.com;" was set.
retrieving cookie(s) for "http://www.netscape.com/" : FOUND: cookie=true
setting cookie for "http://www.netscape.com/" : "cookie=true; domain=.netscape.com;" was set.
retrieving cookie(s) for "http://bla.netscape.com/" : FOUND: cookie=true
1 XPCWrappedNativeScope(s) were constructed.
1 XPCWrappedNativeScopes(s) max alive at one time.
1 XPCWrappedNativeScope(s) alive now.
2 traversals of Scope list.
1 WrappedNatives were constructed. (0 w/ protos, 1 w/o)
1 WrappedNatives max alive at one time. (0 w/ protos, 1 w/o)
1 WrappedNatives alive now. (0 w/ protos, 1 w/o)
0 calls to WrappedNatives. (0 methods, 0 getters, 0 setters)
(wrappers / tearoffs): (0 / 1, 0 / 2, 0 / 3, 0 / 4, 0 / more)
deleting nsXPConnect  with 1 live XPCWrappedNatives
deleting nsXPConnect  with 1 live XPCWrappedNativeScopes
deleting XPCJSRuntime with 1 live JSContexts
deleting XPCJSRuntime with 1 live XPCWrappedNative (found in wrapper check)
deleting XPCJSRuntime with 1 live XPCNativeScriptableShared
+++ XPConnect had no dangling references.
###!!! ASSERTION: Setting main thread twice?: 'Error', file /home/timeless/mozilla/xpcom/threads/nsThread.cpp, line 401
###!!! Break: at file /home/timeless/mozilla/xpcom/threads/nsThread.cpp, line 401

Program received signal SIGSEGV, Segmentation fault.
0x2815f0bc in nsThread::Join (this=0x80c6280) at /home/timeless/mozilla/xpcom/threads/nsThread.cpp:178
178         PR_LOG(nsIThreadLog, PR_LOG_DEBUG,
Current language:  auto; currently c++
(gdb) where
#0  0x2815f0bc in nsThread::Join (this=0x80c6280) at /home/timeless/mozilla/xpcom/threads/nsThread.cpp:178
#1  0x2862c8c0 in nsSocketTransportService::Shutdown (this=0x80b5400)
    at /home/timeless/mozilla/netwerk/base/src/nsSocketTransportService.cpp:735
#2  0x2860cee4 in nsIOService::SetOffline (this=0x80b5380, offline=1) at /home/timeless/mozilla/netwerk/base/src/nsIOService.cpp:857
#3  0x28609b87 in nsIOService::~nsIOService (this=0x80b5380, __in_chrg=3)
    at /home/timeless/mozilla/netwerk/base/src/nsIOService.cpp:250
#4  0x2860a06f in nsIOService::Release (this=0x80b5380) at /home/timeless/mozilla/netwerk/base/src/nsIOService.cpp:296
#5  0x283c1c7a in nsCOMPtr<nsIIOService>::~nsCOMPtr (this=0x812f79c, __in_chrg=2) at ../../dist/include/xpcom/nsCOMPtr.h:490
#6  0x283b3b72 in nsCookieService::~nsCookieService (this=0x812f780, __in_chrg=3)
    at /home/timeless/mozilla/extensions/cookie/nsCookieService.cpp:77
#7  0x283b38d7 in nsCookieService::Release (this=0x812f780) at /home/timeless/mozilla/extensions/cookie/nsCookieService.cpp:64
#8  0x0804e7de in nsCOMPtr<nsICookieService>::~nsCOMPtr (this=0xbfbff7c8, __in_chrg=2) at ../../../dist/include/xpcom/nsCOMPtr.h:490
#9  0x0804b41c in main (argc=1, argv=0xbfbff830) at /home/timeless/mozilla/extensions/cookie/tests/TestCookie.cpp:139
#10 0x0804aa2d in _start ()
(gdb) l
173     nsThread::Join()
174     {
175         // don't check for mDead here because nspr calls Exit (cleaning up
176         // thread-local storage) before they let us join with the thread
177
178         PR_LOG(nsIThreadLog, PR_LOG_DEBUG,
179                ("nsIThread %p start join\n", this));
180         PRStatus status = PR_JoinThread(mThread);
181         // XXX can't use NS_RELEASE here because the macro wants to set
182         // this to null (bad c++)
(gdb) p nsIThreadLog
$1 = (PRLogModuleInfo *) 0x0
(Reporter)

Comment 1

17 years ago
Created attachment 78782 [details] [diff] [review]
this fixes my crashes

each if() is required, i added them as i moved the crash forward.
the ifdef moves are probably not required

i do assert about main thread so TestCookie is still not perfect, but better
assert and quit than crash
(Reporter)

Comment 2

17 years ago
Created attachment 79246 [details] [diff] [review]
scope the nsCOMPtr so that it's destroyed before xpcom shutdown

ok, i found the cause of the assert listed here, this fixes it.

I get one more assert, but that's in a different family, so i filed bug 137512
for it.

Comment 3

17 years ago
Since a large part of this patch is cosmetic involving white space changess, a 
context diff ignoring white spaces would be helpful here.

Comment 4

17 years ago
to cookies.
Assignee: dougt → morse
Component: XPCOM → Cookies
QA Contact: scc → tever

Comment 5

17 years ago
This can't be critical -- it's the test that's flawed, not the browser.
(Reporter)

Comment 6

17 years ago
Created attachment 79260 [details] [diff] [review]
-w

whitespace.

note that the critical is because the code that's crashing is xpcom, it just so
happens that i crashed while using TestCookie, but i think i've crashed there
before.
(Reporter)

Comment 7

17 years ago
Created attachment 79261 [details] [diff] [review]
xpcom/thread as a -u

if i check this in, i'd probably reindent... indentation is always a loser
Comment on attachment 79261 [details] [diff] [review]
xpcom/thread as a -u

why the |if (nsIThreadLog)|? seems to be unnecessary to me
oh yeah, please add a comment stating why you added the braces
Comment on attachment 79261 [details] [diff] [review]
xpcom/thread as a -u

eh, nevermind my last comment on this patch

r=biesi
Attachment #79261 - Flags: review+
Comment on attachment 78782 [details] [diff] [review]
this fixes my crashes

obsolete since this is available as diff -u (attachment 79261 [details] [diff] [review])
Attachment #78782 - Attachment is obsolete: true

Comment 13

17 years ago
Christian, thanks for review the xpcom/thread patch, but (a) I not convinced
that the patch is correct, and (b) it is usually the custom that an module peer
does the review.  

timeless,  why do we need this if()?  Can we make the log file a member of the
class?  Is that the problem?

(Reporter)

Comment 14

17 years ago
dougt: come on, the bototm line is that nsIThread is totally borked.

it doesn't have correct ifdef's. it mixes prlogging with debug with nothing 
with ...
(Reporter)

Comment 15

17 years ago
Created attachment 82745 [details] [diff] [review]
protect prlogging
Attachment #79261 - Attachment is obsolete: true

Comment 16

17 years ago
Comment on attachment 82745 [details] [diff] [review]
protect prlogging

PR_LOG already has the PR_LOGGING test.  This is one example:

-    PR_LOG(nsIThreadLog, PR_LOG_DEBUG,
+#ifdef PR_LOGGING
+    PR_LOG(gThreadLog, PR_LOG_DEBUG,
	    ("nsIThread %p start run %p\n", self, self->mRunnable.get()));
+#endif

Why make this change?

Comment 17

16 years ago
This is not a cookie issue.  Reassigning.
Assignee: morse → rpotts
Component: Cookies → Threading
QA Contact: tever → rpotts
Moving all threading bugs to XPCOM. See bug 160356.
Component: Threading → XPCOM
Assignee: rpotts → nobody
QA Contact: rpotts → xpcom

Updated

7 years ago
Status: NEW → RESOLVED
Last Resolved: 7 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.