crash in nsDocumentViewer::OnDonePrinting @ address 0x5a5a5a5a/e5e5e5e9 use-afer-free
Categories
(Thunderbird :: General, defect)
Tracking
(thunderbird_esr68 verified, thunderbird73 verified)
People
(Reporter: wsmwk, Assigned: benc)
References
Details
(5 keywords, Whiteboard: [regression:TB30][needinfo mats when we have STR])
Crash Data
Attachments
(2 files, 1 obsolete file)
3.45 KB,
patch
|
mkmelin
:
review+
mkmelin
:
approval-comm-beta+
wsmwk
:
approval-comm-esr68+
|
Details | Diff | Splinter Review |
1.21 KB,
patch
|
Details | Diff | Splinter Review |
Reporter | ||
Comment 2•9 years ago
|
||
Reporter | ||
Comment 3•9 years ago
|
||
Comment 4•9 years ago
|
||
Reporter | ||
Updated•9 years ago
|
Comment 5•9 years ago
|
||
Updated•9 years ago
|
Updated•9 years ago
|
Updated•9 years ago
|
Comment 9•9 years ago
|
||
Reporter | ||
Comment 10•9 years ago
|
||
Reporter | ||
Comment 11•9 years ago
|
||
Reporter | ||
Comment 12•8 years ago
|
||
Reporter | ||
Comment 13•8 years ago
|
||
Reporter | ||
Comment 14•8 years ago
|
||
Reporter | ||
Comment 15•8 years ago
|
||
Reporter | ||
Comment 16•7 years ago
|
||
Reporter | ||
Comment 17•6 years ago
|
||
Reporter | ||
Comment 18•5 years ago
|
||
(In reply to Wayne Mery (:wsmwk) from comment #17)
So far as I can tell this signature is gone in version 60
I wonder whatever gave me that idea. Clearly a still a strong top crash in both 60 and 68 - https://crash-stats.mozilla.com/signature/?product=Thunderbird&signature=nsDocumentViewer%3A%3AOnDonePrinting&date=%3E%3D2019-03-14T17%3A42%3A00.000Z&date=%3C2019-09-14T17%3A42%3A00.000Z#graphs
bp-54b2d5d0-f295-47da-9d42-43d590190914 68.1.0
m_kata do you see a useful approach to solving this?
Comment 19•5 years ago
|
||
(In reply to Wayne Mery (:wsmwk) from comment #18)
(In reply to Wayne Mery (:wsmwk) from comment #17)
So far as I can tell this signature is gone in version 60
I wonder whatever gave me that idea. Clearly a still a strong top crash in both 60 and 68 - https://crash-stats.mozilla.com/signature/?product=Thunderbird&signature=nsDocumentViewer%3A%3AOnDonePrinting&date=%3E%3D2019-03-14T17%3A42%3A00.000Z&date=%3C2019-09-14T17%3A42%3A00.000Z#graphs
bp-54b2d5d0-f295-47da-9d42-43d590190914 68.1.0
m_kata do you see a useful approach to solving this?
Hmm, I guess that nsDocumentViewer::OnDonePrinting
uses freed/destroyed nsDocumentViewer
(this). So it may be able to fix by adding KungFuDeathGrip into nsDocumentViewer::Print
...
Comment 21•5 years ago
|
||
Good question. There are already a few KungFuDeathGrip in that code, for example here:
https://searchfox.org/mozilla-central/rev/b58e44b74ef2b4a44bdfb4140c2565ac852504be/layout/base/nsDocumentViewer.cpp#1018
It's not really our code, so hard to poke around in it. Strangely I can't see any crashes for FF. Makoto-san, can you propose a patch. Just add RefPtr<nsDocumentViewer> kungFuDeathGrip(this);
into nsDocumentViewer::Print. But how to convince the reviewer? And if we do, we can then remove some of the other "kung fus", right?
Reporter | ||
Comment 22•5 years ago
|
||
Ryan, can you reach out to some crash reporters? And, are there any useful crash comments from the past 6 months?
Comment 23•5 years ago
|
||
Nothing interesting in the comments that I can see, mostly just people saying it happened when they were trying to print something or canceling printing.
Reporter | ||
Updated•5 years ago
|
Comment 25•5 years ago
|
||
(In reply to Jorg K (GMT+1) (PTO to 19th Jan 2020, sporadically reading bugmail) from comment #21)
Good question. There are already a few KungFuDeathGrip in that code, for example here:
https://searchfox.org/mozilla-central/rev/b58e44b74ef2b4a44bdfb4140c2565ac852504be/layout/base/nsDocumentViewer.cpp#1018It's not really our code, so hard to poke around in it. Strangely I can't see any crashes for FF. Makoto-san, can you propose a patch. Just add
RefPtr<nsDocumentViewer> kungFuDeathGrip(this);
into nsDocumentViewer::Print. But how to convince the reviewer? And if we do, we can then remove some of the other "kung fus", right?
All crash case seems be be that print job is failure.
mWebBrowserPrint
is hold by nsMsgPrintEngine
. Although I don't know PrintMsgWindow
is called before previous print job is finished, if nsMsgPrintEngine
is reused, mWebBrowserPrint
may be released by newer PrintMsgWindow
.
If so, this may be fixed by the following, but I am not sure.
void nsMsgPrintEngine::PrintMsgWindow() {
...
nsCOMPtr<nsIWebBrowserPrint> webBrowserPrint = mWebBrowserPrint;
rv = webBrowserPrint->Print(mPrintSettings,
(nsIWebProgressListener *)this);
Reporter | ||
Comment 26•5 years ago
|
||
Thanks m_kato.
Over to Magnus (or someone else)
Comment 27•5 years ago
|
||
Comment 28•5 years ago
|
||
Assignee | ||
Comment 29•5 years ago
|
||
Assignee | ||
Comment 30•5 years ago
|
||
Here's a patch to turn mWebBrowserPrint
into a local variable instead.
In theory, that might better handle recursive calling of nsMsgPrintEngine::PrintMsgWindow()
... but if that really is what's happening (and I have my doubts), then surely there'll be bigger problems...
So I can't really see this helping, but hey.
I'll have a quick go and try and see if I can replicate the bug by artificially failing the print job.
Updated•5 years ago
|
Updated•5 years ago
|
Comment 31•5 years ago
|
||
Pushed by mkmelin@iki.fi:
https://hg.mozilla.org/comm-central/rev/8386d49168fa
Move nsMsgPrintEngine mWebBrowserPrint to function scope to avoid potential reuse crash. r=mkmelin
Updated•5 years ago
|
Updated•5 years ago
|
Reporter | ||
Comment 32•5 years ago
|
||
Beta has ~3 crashes per week, so to determine the effect of this patch I suggest we uplift it right to beta 73.
Updated•5 years ago
|
Comment 33•5 years ago
|
||
Reporter | ||
Comment 34•5 years ago
|
||
I can verify this is fixed on beta as of v73. https://crash-stats.mozilla.org/signature/?release_channel=%21release&signature=nsDocumentViewer%3A%3AOnDonePrinting&date=%3E%3D2019-12-06T07%3A11%3A00.000Z&date=%3C2020-03-06T07%3A11%3A00.000Z
Reporter | ||
Comment 35•5 years ago
|
||
Reporter | ||
Comment 36•5 years ago
|
||
Comment 37•5 years ago
|
||
I have a try build with the patch applied (just started it, so still running) at https://treeherder.mozilla.org/#/jobs?repo=try-comm-central&revision=c3758dd8a668e03870f85b183b397e6cd34faa13
Comment 38•5 years ago
|
||
That patch applies fine, but the changed file does not compile now.
/builds/worker/workspace/build/src/clang/bin/clang++ -o nsMsgPrintEngine.o -c -I/builds/worker/workspace/build/src/obj-thunderbird/dist/stl_wrappers -I/builds/worker/workspace/build/src/obj-thunderbird/dist/system_wrappers -include /builds/worker/workspace/build/src/config/gcc_hidden.h -DNDEBUG=1 -DTRIMMED=1 -DSTATIC_EXPORTABLE_JS_API -DMOZ_HAS_MOZGLUE -DMOZILLA_INTERNAL_API -DIMPL_LIBXUL -I/builds/worker/workspace/build/src/comm/mailnews/base/src -I/builds/worker/workspace/build/src/obj-thunderbird/comm/mailnews/base/src -I/builds/worker/workspace/build/src/dom/base -I/builds/worker/workspace/build/src/obj-thunderbird/dist/include -I/builds/worker/workspace/build/src/obj-thunderbird/dist/include/nspr -I/builds/worker/workspace/build/src/obj-thunderbird/dist/include/nss -fPIC -DMOZILLA_CLIENT -include /builds/worker/workspace/build/src/obj-thunderbird/mozilla-config.h -Qunused-arguments -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-strong -Qunused-arguments -Wall -Wbitfield-enum-conversion -Wempty-body -Wignored-qualifiers -Woverloaded-virtual -Wpointer-arith -Wshadow-field-in-constructor-modified -Wsign-compare -Wtype-limits -Wunreachable-code -Wunreachable-code-return -Wwrite-strings -Wno-invalid-offsetof -Wclass-varargs -Wfloat-overflow-conversion -Wfloat-zero-conversion -Wloop-analysis -Wc++1z-compat -Wc++2a-compat -Wcomma -Wimplicit-fallthrough -Werror=non-literal-null-conversion -Wstring-conversion -Wtautological-overlap-compare -Wtautological-unsigned-enum-zero-compare -Wtautological-unsigned-zero-compare -Wno-inline-new-delete -Wno-error=deprecated-declarations -Wno-error=array-bounds -Wno-error=backend-plugin -Wno-error=return-std-move -Wno-error=atomic-alignment -Wformat -Wformat-security -Wno-gnu-zero-variadic-macro-arguments -Wno-unknown-warning-option -Wno-return-type-c-linkage -D_GLIBCXX_USE_CXX11_ABI=0 -fno-sized-deallocation -fcrash-diagnostics-dir=/builds/worker/artifacts -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-strong -fno-exceptions -fno-strict-aliasing -fno-rtti -ffunction-sections -fdata-sections -fno-exceptions -fno-math-errno -pthread -pipe -g -Xclang -load -Xclang /builds/worker/workspace/build/src/obj-thunderbird/build/clang-plugin/libclang-plugin.so -Xclang -add-plugin -Xclang moz-check -O2 -fomit-frame-pointer -funwind-tables -Werror -MD -MP -MF .deps/nsMsgPrintEngine.o.pp /builds/worker/workspace/build/src/comm/mailnews/base/src/nsMsgPrintEngine.cpp
/builds/worker/workspace/build/src/comm/mailnews/base/src/nsMsgPrintEngine.cpp:338:19: error: use of undeclared identifier 'mWebBrowserPrint'
domWin, mWebBrowserPrint, mPrintSettings, this, aIsForPrinting,
Comment 39•5 years ago
|
||
I found that ShowPrintProgressDialog accepts NULL for the mWebBrowserPrint parameter, so I changed it and now the above patch compiles when applied to comm-esr68.
It doesn't look like ShowPrintProgressDialog does anything with that variable(?) and I'm able to print, print preview, etc with the build I did with it applied.
Comment 40•5 years ago
|
||
s/NULL/nullptr/.
Reporter | ||
Comment 41•5 years ago
|
||
Thanks for checking it. I assume Ben is off the hook.
Comment 42•5 years ago
|
||
Reporter | ||
Comment 43•5 years ago
|
||
verified gone in ESr
Reporter | ||
Comment 44•5 years ago
|
||
correcting mistake
Description
•