Closed Bug 626437 Opened 9 years ago Closed 9 years ago

New shark code only works once, then fails, then hangs

Categories

(Core :: JavaScript Engine, defect)

x86
macOS
defect
Not set

Tracking

()

RESOLVED FIXED

People

(Reporter: bzbarsky, Assigned: gal)

References

Details

(Whiteboard: fixed-in-tracemonkey)

Attachments

(1 file)

BUILD: Current tip TM build

STEPS TO REPRODUCE:

1)  Put the following in ~/test.js: "startProfiling(); stopProfiling();"
2)  Start shark and put it in programmatic control mode
3)  Build an optimized js shell with --enable-shark
4)  Run |js ~/test.js|
5)  Run |js ~/test.js|
6)  Run |js ~/test.js|

(yes, do it three times).

EXPECTED RESULTS: 3 profiles generated

ACTUAL RESULTS: Step 4 generates a profile.  Step 5 doesn't generate a profile.  Step 6 hangs the shell; attaching a debugger shows this stack:

#0  0x00007fff846c82da in mach_msg_trap ()
#1  0x00007fff846c894d in mach_msg ()
#2  0x000000010018022b in Shark::Start ()
#3  0x0000000100104ce9 in js::Probes::startProfiling ()
#4  0x000000010003e961 in StartProfiling ()

This severely limits the usefulness of the new profiler hooks, unfortunately.  :(
Patrick does this happen with your code too or did I break something?
(Patrick is not in today, we will look tomorrow.)
More data:

a) Step 2 in comment 0 needs to include setting the sampling interval to 20us.
   If I leave it at 1ms, then shark gives an alert about no samples, and the js
   shell hangs.
b) The hang from step 6 above and the hang from (a) above both stop if I quit
   shark.
Attached patch patchSplinter Review
Embarrassing.
Assignee: general → gal
bz want to give this a spin?
Attachment #505537 - Flags: review?(bzbarsky)
Comment on attachment 505537 [details] [diff] [review]
patch

Works for me.
Attachment #505537 - Flags: feedback+
This fixes the steps in comment 0, but only with the 20us setting.  If I use a sample interval large enough that there are no samples, then the shell still hangs waiting on shark.  I'd tell you where it hangs, but trying to attach gdb to it hangs gdb.... 

Separate bug on that?
Comment on attachment 505537 [details] [diff] [review]
patch

r=me; the other issue is more likely a problem in the sharkctl stuff...
Attachment #505537 - Flags: review?(bzbarsky) → review+
(In reply to comment #7)
> This fixes the steps in comment 0, but only with the 20us setting.  If I use a
> sample interval large enough that there are no samples, then the shell still
> hangs waiting on shark.  I'd tell you where it hangs, but trying to attach gdb
> to it hangs gdb.... 
> 
> Separate bug on that?

Did this happen with the old CHUD stuff?
http://hg.mozilla.org/tracemonkey/rev/33313f209f4d
Whiteboard: fixed-in-tracemonkey
> Did this happen with the old CHUD stuff?

Not that I recall.  I certainly recall getting that popup from Shark in some cases, but I never recall the browser freezing in the process.
(In reply to comment #11)
> > Did this happen with the old CHUD stuff?
> 
> Not that I recall.  I certainly recall getting that popup from Shark in some
> cases, but I never recall the browser freezing in the process.

Okay, if you could file a followup bug then that'd be awesome. If I had to guess I'd say that Shark is trying to send us an error code, but I haven't reverse engineered that part of the protocol yet, so we end up blocking on a Mach message that never arrives.
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
> Okay, if you could file a followup bug then that'd be awesome

Filed bug 628153
You need to log in before you can comment on or make changes to this bug.