Closed Bug 1378308 Opened 3 years ago Closed 3 years ago

Assertion failure: tr != JS::TranscodeResult_Failure_BadBuildId && tr != JS::TranscodeResult_Failure_WrongCompileOption, at /opt/moz/hg-inbound-2/dom/base/nsJSUtils.cpp:307

Categories

(Core :: Networking: Cache, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla56
Tracking Status
firefox56 --- fixed

People

(Reporter: michal, Assigned: michal)

References

(Blocks 1 open bug)

Details

(Whiteboard: [necko-active])

Attachments

(1 file)

I'll keep the rr session for a short while, so let me know if you need any other info.

(rr) p decoder.resultCode()
$11 = JS::TranscodeResult_Failure_BadBuildId

(rr) bt
#0  0xffffffff in JS::DecodeScript(JSContext*, mozilla::Vector<unsigned char, 0u, mozilla::MallocAllocPolicy>&, JS::MutableHandle<JSScript*>, unsigned int) (cx=0xf7167000, buffer=..., scriptp=..., cursorIndex=2192) at /opt/moz/hg-inbound-2/js/src/jsapi.cpp:7139
#1  0xffffffff in nsJSUtils::ExecutionContext::DecodeAndExec(JS::CompileOptions&, mozilla::Vector<unsigned char, 0u, mozilla::MallocAllocPolicy>&, unsigned int) (this=0xffb70918, aCompileOptions=..., aBytecodeBuf=..., aBytecodeIndex=2192)
    at /opt/moz/hg-inbound-2/dom/base/nsJSUtils.cpp:302
#2  0xffffffff in mozilla::dom::ScriptLoader::EvaluateScript(mozilla::dom::ScriptLoadRequest*) (this=0xbc1cede0, aRequest=0xbbb71400)
    at /opt/moz/hg-inbound-2/dom/script/ScriptLoader.cpp:2151
#3  0xffffffff in mozilla::dom::ScriptLoader::ProcessRequest(mozilla::dom::ScriptLoadRequest*) (this=0xbc1cede0, aRequest=0xbbb71400)
    at /opt/moz/hg-inbound-2/dom/script/ScriptLoader.cpp:1773
#4  0xffffffff in mozilla::dom::ScriptLoader::ProcessPendingRequests() (this=0xbc1cede0)
    at /opt/moz/hg-inbound-2/dom/script/ScriptLoader.cpp:2439
#5  0xffffffff in mozilla::detail::RunnableMethodImpl<mozilla::dom::ScriptLoader*, void (mozilla::dom::ScriptLoader::*)(), true, (mozilla::RunnableKind)0>::Run() (args=..., m=<optimized out>, o=<optimized out>)
    at /opt/moz/hg-inbound-2/_obj-browser-release-tb-fp-dbg/dist/include/nsThreadUtils.h:1138
#6  0xffffffff in mozilla::detail::RunnableMethodImpl<mozilla::dom::ScriptLoader*, void (mozilla::dom::ScriptLoader::*)(), true, (mozilla::RunnableKind)0>::Run() (m=<optimized out>, o=<optimized out>, this=0xbad23750)
    at /opt/moz/hg-inbound-2/_obj-browser-release-tb-fp-dbg/dist/include/nsThreadUtils.h:1145
#7  0xffffffff in mozilla::detail::RunnableMethodImpl<mozilla::dom::ScriptLoader*, void (mozilla::dom::ScriptLoader::*)(), true, (mozilla::RunnableKind)0>::Run() (this=0xbad23730)
    at /opt/moz/hg-inbound-2/_obj-browser-release-tb-fp-dbg/dist/include/nsThreadUtils.h:1187
#8  0xffffffff in nsThread::ProcessNextEvent(bool, bool*) (this=0xf71eb290, aMayWait=false, aResult=0xffb70b9f)
    at /opt/moz/hg-inbound-2/xpcom/threads/nsThread.cpp:1422
#9  0xffffffff in NS_ProcessNextEvent(nsIThread*, bool) (aThread=0xf71eb290, aMayWait=false)
    at /opt/moz/hg-inbound-2/xpcom/threads/nsThreadUtils.cpp:489
#10 0xffffffff in mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate*) (this=0xf3402310, aDelegate=0xf710c120)
    at /opt/moz/hg-inbound-2/ipc/glue/MessagePump.cpp:97
#11 0xffffffff in MessageLoop::RunInternal() (this=0xf710c120) at /opt/moz/hg-inbound-2/ipc/chromium/src/base/message_loop.cc:320
#12 0xffffffff in MessageLoop::Run() (this=0xf710c120) at /opt/moz/hg-inbound-2/ipc/chromium/src/base/message_loop.cc:313
#13 0xffffffff in MessageLoop::Run() (this=0xf710c120) at /opt/moz/hg-inbound-2/ipc/chromium/src/base/message_loop.cc:293
#14 0xffffffff in nsBaseAppShell::Run() (this=0xe63bb0b0) at /opt/moz/hg-inbound-2/widget/nsBaseAppShell.cpp:156
#15 0xffffffff in nsAppStartup::Run() (this=0xe63af760) at /opt/moz/hg-inbound-2/toolkit/components/startup/nsAppStartup.cpp:287
#16 0xffffffff in XREMain::XRE_mainRun() (this=0xffb70e54) at /opt/moz/hg-inbound-2/toolkit/xre/nsAppRunner.cpp:4589
#17 0xffffffff in XREMain::XRE_main(int, char**, mozilla::BootstrapConfig const&) (this=0xffb70e54, argc=3, argv=0xffb720c4, aConfig=...) at /opt/moz/hg-inbound-2/toolkit/xre/nsAppRunner.cpp:4772
#18 0xffffffff in XRE_main(int, char**, mozilla::BootstrapConfig const&) (argc=3, argv=0xffb720c4, aConfig=...)
    at /opt/moz/hg-inbound-2/toolkit/xre/nsAppRunner.cpp:4867
#19 0x0804cf7c in do_main(int, char**, char**) (argc=argc@entry=3, argv=argv@entry=0xffb720c4, envp=envp@entry=0xffb720d4)
    at /opt/moz/hg-inbound-2/browser/app/nsBrowserApp.cpp:237
#20 0x0804c99c in main(int, char**, char**) (argc=3, argv=0xffb720c4, envp=0xffb720d4)
    at /opt/moz/hg-inbound-2/browser/app/nsBrowserApp.cpp:310
This assertion is not supposed to happen, because it should have been guarded by the preferred alternate data type.
In the client process where the assertion happen, from the assertion, run the following list of commands:

1. I want to know what build id got decoded:

 (rr) b js/src/vm/Xdr.cpp#114
 (rr) rc
 # stop at http://searchfox.org/mozilla-central/rev/e8f4f51cd543f203e9cb861cecb7545ac43c836c/js/src/vm/Xdr.cpp#114
 (rr) p decodedBuildId

2. And compare it to the provided build id from the alternate data type:

 # #2  0xffffffff in mozilla::dom::ScriptLoader::EvaluateScript(mozilla::dom::ScriptLoadRequest*)
 (rr) f 2
 (rr) watch -l aRequest->mDataType
 (rr) rc
 # stop at http://searchfox.org/mozilla-central/rev/e8f4f51cd543f203e9cb861cecb7545ac43c836c/dom/script/ScriptLoadHandler.cpp#292
 (rr) rn 2
 (rr) p altDataType

3. And compare it to the requested build id:

 (rr) p nsContentUtils::JSBytecodeMimeType()

All 3 build ids should match, but this assertion highlight that one of them is different.
  (3) != (2)  => Unexpected alternate data provided.
  (3) == (2) && (2) != (1)  =>  Bad encoding?!  (in which case I would be interested in the url of the script / document)
(In reply to Nicolas B. Pierron [:nbp] from comment #1)
> This assertion is not supposed to happen, because it should have been
> guarded by the preferred alternate data type.
> In the client process where the assertion happen, from the assertion, run
> the following list of commands:
> 
> 1. I want to know what build id got decoded:
> 
>  (rr) b js/src/vm/Xdr.cpp#114
>  (rr) rc
>  # stop at
> http://searchfox.org/mozilla-central/rev/
> e8f4f51cd543f203e9cb861cecb7545ac43c836c/js/src/vm/Xdr.cpp#114
>  (rr) p decodedBuildId

It fails at http://searchfox.org/mozilla-central/rev/e8f4f51cd543f203e9cb861cecb7545ac43c836c/js/src/vm/Xdr.cpp#95 because buildIdLength is 3741841199.
(In reply to Michal Novotny (:michal) from comment #2)
> It fails at
> http://searchfox.org/mozilla-central/rev/
> e8f4f51cd543f203e9cb861cecb7545ac43c836c/js/src/vm/Xdr.cpp#95 because
> buildIdLength is 3741841199.

Can you dump the content of xdr->buf_.buffer and send it to me, in order to decode it by hand?

Do you have a way to verify of this data corresponds to the one stored in the cache?
When racing cache with network and the network wins, we don't reset mAvailableCachedAltDataType. So when the cache entry has been opened and has alt-data then nsHttpChannel::GetAlternativeDataType returns alt-data type, but we're delivering raw response (no conversion are applied) from the network.

This shouldn't normally happen, because we don't race if CacheIndex tells us the entry has alt-data, but info from CacheIndex might be inaccurate and/or alt-data might be written after the check and before the entry is obtained.
Assignee: nobody → michal.novotny
Blocks: RCWN
Component: JavaScript Engine → Networking: Cache
Whiteboard: [necko-active]
Attached patch fixSplinter Review
Attachment #8883871 - Flags: review?(valentin.gosu)
Attachment #8883871 - Flags: review?(valentin.gosu) → review+
Pushed by mnovotny@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/f74cecd66848
nsHttpChannel::GetAlternativeDataType returns alt-data type when delivering data from network, r=valentin
https://hg.mozilla.org/mozilla-central/rev/f74cecd66848
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla56
You need to log in before you can comment on or make changes to this bug.