Skip to content

Borrow hazard when calling Tokenizer::end from ServoParser::do_parse_sync #24115

@jdm

Description

@jdm

With zealous GC, we expose a borrow failure when ending tokenizing:

 4:16.33 pid:93228 DomRefCell<T> already mutably borrowed: BorrowError (thread ScriptThread PipelineId { namespace_id: PipelineNamespaceId(1), index: PipelineIndex(1) }, at src/libcore/result.rs:1084)
 4:17.00 pid:93228 stack backtrace:
 4:17.00 pid:93228    0: __ZN9backtrace9backtrace5trace17hc4a0d1f273e07024E (0x10f073d7b)
 4:17.00 pid:93228    1: __ZN9backtrace7capture9Backtrace3new17h765760e39b281a50E (0x10f072f67)
 4:17.00 pid:93228    2: __ZN5servo4main28_$u7b$$u7b$closure$u7d$$u7d$17h510947304905906eE (0x10b7d47db)
 4:17.00 pid:93228    3: __ZN3std9panicking20rust_panic_with_hook17h099fe3773ce1a793E (0x10f1ffe41)
 4:17.00 pid:93228    4: __ZN3std9panicking18continue_panic_fmt17h8a4b76634870b383E (0x10f1ff8ac)
 4:17.00 pid:93228    5: _rust_begin_unwind (0x10f1ff7a8)
 4:17.00 pid:93228    6: __ZN4core9panicking9panic_fmt17h885799c19d2b8b0cE (0x10f21ffde)
 4:17.01 pid:93228    7: __ZN4core6result13unwrap_failed17h91161a3faccc6622E (0x10f2200b8)
 4:17.01 pid:93228    8: __ZN110_$LT$script..dom..bindings..cell..DomRefCell$LT$T$GT$$u20$as$u20$script..dom..bindings..trace..JSTraceable$GT$5trace17had7eda3ca734e750E (0x10bdfd3d8)
 4:17.01 pid:93228    9: ___rust_maybe_catch_panic (0x10f2081de)
 4:17.01 pid:93228   10: __ZN6script3dom8bindings7codegen8Bindings18ServoParserBinding18ServoParserBinding6_trace17hcb09c9acba2f1213E (0x10c512fb7)
 4:17.01 pid:93228   11: __ZNK2js5Class7doTraceEP8JSTracerP8JSObject (0x10d1cebdb)
 4:17.01 pid:93228   12: __ZL13CallTraceHookIZN2js8GCMarker19processMarkStackTopERNS0_11SliceBudgetEEUlT_E_EPNS0_12NativeObjectEOS4_P8JSTracerP8JSObject15CheckGeneration (0x10d45f583)
 4:17.01 pid:93228   13: __ZN2js8GCMarker19processMarkStackTopERNS_11SliceBudgetE (0x10d417ecf)
 4:17.01 pid:93228   14: __ZN2js8GCMarker24markUntilBudgetExhaustedERNS_11SliceBudgetE (0x10d3fc134)
 4:17.01 pid:93228   15: __ZN2js2gc9GCRuntime24markUntilBudgetExhaustedERNS_11SliceBudgetENS_7gcstats9PhaseKindE (0x10d3f8ee5)
 4:17.01 pid:93228   16: __ZN2js2gc9GCRuntime16incrementalSliceERNS_11SliceBudgetEN2JS8GCReasonERNS0_13AutoGCSessionE (0x10d401163)
 4:17.02 pid:93228   17: __ZN2js2gc9GCRuntime7gcCycleEbNS_11SliceBudgetEN2JS8GCReasonE (0x10d402e32)
 4:17.02 pid:93228   18: __ZN2js2gc9GCRuntime7collectEbNS_11SliceBudgetEN2JS8GCReasonE (0x10d4044e3)
 4:17.02 pid:93228   19: __ZN2js2gc9GCRuntime2gcE18JSGCInvocationKindN2JS8GCReasonE (0x10d3cdcb6)
 4:17.02 pid:93228   20: __ZN2js2gc9GCRuntime10runDebugGCEv (0x10d3cda34)
 4:17.02 pid:93228   21: __ZN2js2gc9GCRuntime22gcIfNeededAtAllocationEP9JSContext (0x10d3cd3a5)
 4:17.02 pid:93228   22: __ZN2js2gc9GCRuntime19checkAllocatorStateILNS_7AllowGCE1EEEbP9JSContextNS0_9AllocKindE (0x10d3c89f1)
 4:17.02 pid:93228   23: __ZN2js8AllocateINS_11ObjectGroupELNS_7AllowGCE1EEEPT_P9JSContext (0x10d3cb918)
 4:17.02 pid:93228   24: __ZN2js16ObjectGroupRealm9makeGroupEP9JSContextPN2JS5RealmEPKNS_5ClassENS3_6HandleINS_11TaggedProtoEEEj (0x10ce86688)
 4:17.02 pid:93228   25: __ZN8JSObject13makeLazyGroupEP9JSContextN2JS6HandleIPS_EE (0x10ce8646b)
 4:17.02 pid:93228   26: __ZN8JSObject8getGroupEP9JSContextN2JS6HandleIPS_EE (0x10cdf634e)
 4:17.02 pid:93228   27: __ZN8JSObject15splicePrototypeEP9JSContextN2JS6HandleIPS_EENS3_IN2js11TaggedProtoEEE (0x10ce85f09)
 4:17.02 pid:93228   28: __Z18JS_SplicePrototypeP9JSContextN2JS6HandleIP8JSObjectEES5_ (0x10d210b9b)
 4:17.02 pid:93228   29: __Z26JS_NewObjectWithUniqueTypeP9JSContextPK7JSClassN2JS6HandleIP8JSObjectEE (0x10d210d5b)
 4:17.02 pid:93228   30: __ZN6script3dom8bindings9interface13create_object17h8986b5acf9af4f2dE (0x10c61d1b5)
 4:17.02 pid:93228   31: __ZN6script3dom8bindings9interface33create_interface_prototype_object17h88cc524928e422e3E (0x10c61c9ee)
 4:17.02 pid:93228   32: __ZN6script3dom8bindings7codegen8Bindings22HTMLBodyElementBinding22HTMLBodyElementBinding22CreateInterfaceObjects17h2b8b8414feb603deE.llvm.4880966149733538817 (0x10c860ebe)
 4:17.02 pid:93228   33: __ZN6script3dom8bindings7codegen8Bindings22HTMLBodyElementBinding22HTMLBodyElementBinding4Wrap17he01419c0c8076f7fE (0x10c860839)
 4:17.02 pid:93228   34: __ZN6script3dom6create26create_native_html_element17h5f0ccfb8d68fb478E (0x10bf71e84)
 4:17.02 pid:93228   35: __ZN6script3dom6create14create_element17h16d5824be611a653E (0x10bf73c2b)
 4:17.02 pid:93228   36: __ZN6script3dom11servoparser24create_element_for_token17h26510e09c0520b4fE (0x10c2ffc65)
 4:17.02 pid:93228   37: __ZN97_$LT$script..dom..servoparser..Sink$u20$as$u20$markup5ever..interface..tree_builder..TreeSink$GT$14create_element17hc33c3c0aeb0eb546E (0x10c2fcb7d)
 4:17.02 pid:93228   38: __ZN11markup5ever9interface12tree_builder14create_element17h90bb47d0a1bca068E (0x10bf99153)
 4:17.03 pid:93228   39: __ZN9html5ever12tree_builder32TreeBuilder$LT$Handle$C$Sink$GT$14insert_element17hb678b927dc5a81cdE (0x10c7dd964)
 4:17.03 pid:93228   40: __ZN9html5ever12tree_builder32TreeBuilder$LT$Handle$C$Sink$GT$4step17he4f4df0d0604f86bE (0x10c7f4e14)
 4:17.03 pid:93228   41: __ZN120_$LT$html5ever..tree_builder..TreeBuilder$LT$Handle$C$Sink$GT$$u20$as$u20$html5ever..tokenizer..interface..TokenSink$GT$13process_token17h6adb751266517276E (0x10c78ca34)
 4:17.03 pid:93228   42: __ZN9html5ever9tokenizer21Tokenizer$LT$Sink$GT$13process_token17hd3e0905ceb9fdbefE.llvm.13403837931426071822 (0x10beb7802)
 4:17.03 pid:93228   43: __ZN6script3dom11servoparser4html9Tokenizer3end17hbf1b2123742649a0E (0x10beeb28a)
 4:17.03 pid:93228   44: __ZN6script3dom11servoparser11ServoParser13do_parse_sync17ha608c3845fd71bd5E (0x10c2f67c0)
 4:17.03 pid:93228   45: __ZN14profile_traits4time7profile17h5030af151774cb74E (0x10c5f603d)
 4:17.03 pid:93228   46: __ZN6script3dom11servoparser11ServoParser10parse_sync17h5e54198daa0f3441E.llvm.15491451777926491180 (0x10c2f54da)
 4:17.03 pid:93228   47: __ZN6script3dom11servoparser11ServoParser43resume_with_pending_parsing_blocking_script17h84c2e7bcb8c48ce6E (0x10c2f33e2)
 4:17.03 pid:93228   48: __ZN6script3dom8document8Document39process_pending_parsing_blocking_script17h19a631d52f765e5cE (0x10c44cafd)
 4:17.03 pid:93228   49: __ZN6script3dom8document8Document38pending_parsing_blocking_script_loaded17he380e1268a6a6f9cE (0x10c44c6ae)
 4:17.03 pid:93228   50: __ZN99_$LT$script..dom..htmlscriptelement..ScriptContext$u20$as$u20$net_traits..FetchResponseListener$GT$20process_response_eof17hbeea62ba1532241eE (0x10c59c1e5)
 4:17.03 pid:93228   51: __ZN76_$LT$net_traits..FetchResponseMsg$u20$as$u20$net_traits..Action$LT$T$GT$$GT$7process17h1e3f419940403dd4E (0x10c8c7e67)
 4:17.03 pid:93228   52: __ZN101_$LT$script..network_listener..ListenerTask$LT$A$C$Listener$GT$$u20$as$u20$script..task..TaskOnce$GT$8run_once17h53b608f73558fd98E (0x10c75bdac)
 4:17.03 pid:93228   53: __ZN43_$LT$T$u20$as$u20$script..task..TaskBox$GT$7run_box17hdd2d15a7c0a73618E (0x10c8f159e)
 4:17.03 pid:93228   54: __ZN6script13script_thread12ScriptThread22handle_msg_from_script17h9e03eb14b1d6d27aE (0x10c4c8cf7)
 4:17.03 pid:93228   55: __ZN6script13script_thread12ScriptThread11handle_msgs17h689a61696977da24E.llvm.16624544286892866357 (0x10c4c0b1b)
 4:17.03 pid:93228   56: __ZN14profile_traits3mem12ProfilerChan25run_with_memory_reporting17h7b6e9bd38e1ab8feE (0x10c5f3c87)
 4:17.03 pid:93228   57: __ZN3std10sys_common9backtrace28__rust_begin_short_backtrace17he46720d101a3e6efE (0x10c8a10bb)
 4:17.04 pid:93228   58: __ZN3std9panicking3try7do_call17h5f1d988e7dc73db4E.llvm.16932765531113996662 (0x10bd6c54a)
 4:17.04 pid:93228   59: ___rust_maybe_catch_panic (0x10f2081de)
 4:17.04 pid:93228   60: __ZN4core3ops8function6FnOnce40call_once$u7b$$u7b$vtable.shim$u7d$$u7d$17hc92a2538c3cac723E (0x10bfa8755)
 4:17.04 pid:93228   61: __ZN83_$LT$alloc..boxed..Box$LT$F$GT$$u20$as$u20$core..ops..function..FnOnce$LT$A$GT$$GT$9call_once17hb03304ace7f89c63E (0x10f1ef56d)
 4:17.04 pid:93228   62: __ZN3std3sys4unix6thread6Thread3new12thread_start17hd2d570f25bb299f3E (0x10f20770d)
 4:17.04 pid:93228   63: __pthread_body (0x7fff63578660)
 4:17.04 pid:93228   64: __pthread_start (0x7fff6357850c)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-content/parsersRelated to parsing HTML and XMLI-panicServo encounters a panic.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions