Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix edge panning crash and add warnings #3704

Closed

Conversation

rolandlo
Copy link
Member

@rolandlo rolandlo commented Jan 7, 2022

Fixes #3618. Warnings have been included to detect the problem.

@rolandlo
Copy link
Member Author

rolandlo commented Jan 7, 2022

/azp run create-installers

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@LittleHuba
Copy link
Member

The requested installers were generated successfully. The installers are available at:

Please be aware that these links are only valid for a limited time (~30 days).

@rolandlo
Copy link
Member Author

rolandlo commented Jan 7, 2022

@youngminpark2559 Would you please try out the installer and run from terminal? You should see some warnings instead of a crash (hopefully). Please report them back.

@youngminpark2559
Copy link

@rolandlo Sure. I'll update the version from 1.1.0 and run xournalpp in terminal to see crash warnings

@rolandlo
Copy link
Member Author

rolandlo commented Jan 8, 2022

@rolandlo Sure. I'll update the version from 1.1.0 and run xournalpp in terminal to see crash warnings

Just to make clear:You will have to use the installer provided above (in this comment).

@youngminpark2559
Copy link

@rolandlo Yes, I installed the app through above link installer Ubuntu 20.04
image
and running on the terminal
image

@youngminpark2559
Copy link

@rolandlo I'm not sure if this warning message is related to crash error, I saw this warning
image

I tried to reproduce crash error with the file which has a lot of screenshot images but crash warning message (edge panning) strangely didn't occur yet in terminal

@rolandlo
Copy link
Member Author

@rolandlo I'm not sure if this warning message is related to crash error, I saw this warning image

I tried to reproduce crash error with the file which has a lot of screenshot images but crash warning message (edge panning) strangely didn't occur yet in terminal

These warnings (DocumentView::drawStroke empty stroke...) are harmless, I think, and are certainly unrelated to the crash. Did you get a crash though? If so, please include the error message again. Otherwise please continue testing until you either get a crash or see one of the warnings Selection does not exist anymore while handling edge panning or View does not exist anymore while handling edge panning. As long as you don't see any of these warnings, the app behaves exactly like before.

@youngminpark2559
Copy link

@rolandlo I haven't met crash warnings (Selection does not... or View does not ...) or crash even if I tried to run the app on the same files and environment where I encountered the crash.

The other day, I updated xournalpp through Ubuntu's automatic update and I performed apt-get purge xournalpp to install the app through above linked installer.

I'll report the edge panning warnings if I encounter them on terminal or icon execution

@youngminpark2559
Copy link

youngminpark2559 commented Jan 12, 2022

@rolandlo I got the edge panning error message. And the app crashed as well as warning message. Hope this helps.

image

And the log file contents (/home/young/.cache/xournalpp/errorlogs/errorlog.20220112-170604.log)

Date: Wed Jan 12 17:06:04 2022
Error: signal 11
[bt]: (0) xournalpp(+0x1ee264) [0x555f7f87f264]
[bt]: (1) /lib/x86_64-linux-gnu/libc.so.6(+0x46210) [0x7ff850d06210]
[bt]: (2) xournalpp(_ZN11XournalView10getControlEv+0x4) [0x555f7f80ae14]
[bt]: (3) xournalpp(_ZN13EditSelection13handleEdgePanEPS_+0x51) [0x555f7f7c41e1]
[bt]: (4) /lib/x86_64-linux-gnu/libglib-2.0.so.0(+0x52be8) [0x7ff852268be8]
[bt]: (5) /lib/x86_64-linux-gnu/libglib-2.0.so.0(g_main_context_dispatch+0x14e) [0x7ff85226804e]
[bt]: (6) /lib/x86_64-linux-gnu/libglib-2.0.so.0(+0x52400) [0x7ff852268400]
[bt]: (7) /lib/x86_64-linux-gnu/libglib-2.0.so.0(g_main_context_iteration+0x33) [0x7ff8522684a3]
[bt]: (8) /lib/x86_64-linux-gnu/libgio-2.0.so.0(g_application_run+0x205) [0x7ff8516b3fe5]
[bt]: (9) xournalpp(_ZN11XournalMain3runEiPPc+0x4af) [0x555f7f774b7f]
[bt]: (10) /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf3) [0x7ff850ce70b3]
[bt]: (11) xournalpp(_start+0x2e) [0x555f7f7528be]


Try to get a better stracktrace...
[bt] #1 xournalpp(+0x1ee739) [0x555f7f87f739]
??:0
[bt] #2 /lib/x86_64-linux-gnu/libc.so.6(+0x46210) [0x7ff850d06210]
??:0
[bt] #3 xournalpp(_ZN11XournalView10getControlEv+0x4) [0x555f7f80ae14]
??:0
[bt] #4 xournalpp(_ZN13EditSelection13handleEdgePanEPS_+0x51) [0x555f7f7c41e1]
??:0
[bt] #5 /lib/x86_64-linux-gnu/libglib-2.0.so.0(+0x52be8) [0x7ff852268be8]
??:0
[bt] #6 /lib/x86_64-linux-gnu/libglib-2.0.so.0(g_main_context_dispatch+0x14e) [0x7ff85226804e]
??:0
[bt] #7 /lib/x86_64-linux-gnu/libglib-2.0.so.0(+0x52400) [0x7ff852268400]
??:0
[bt] #8 /lib/x86_64-linux-gnu/libglib-2.0.so.0(g_main_context_iteration+0x33) [0x7ff8522684a3]
??:0
[bt] #9 /lib/x86_64-linux-gnu/libgio-2.0.so.0(g_application_run+0x205) [0x7ff8516b3fe5]
??:0
[bt] #10 xournalpp(_ZN11XournalMain3runEiPPc+0x4af) [0x555f7f774b7f]
??:0
[bt] #11 /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf3) [0x7ff850ce70b3]
??:0
[bt] #12 xournalpp(_start+0x2e) [0x555f7f7528be]
??:0

@rolandlo
Copy link
Member Author

/azp run create-installers

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@rolandlo
Copy link
Member Author

@rolandlo I got the edge panning error message. And the app crashed as well as warning message. Hope this helps.

Thanks for the testing, the warning message and the crash log.
The warning shows that some crashes are already prevented through this PR. The crash that happened later. With the latest commit that I pushed that crash also cannot occur anymore. Please use the new installer (when it has finished building) and see, if you still get a crash sometimes.

@LittleHuba
Copy link
Member

The requested installers were generated successfully. The installers are available at:

Please be aware that these links are only valid for a limited time (~30 days).

@youngminpark2559
Copy link

@rolandlo I installed through above installer
image

And I got the crash but the warning message didn't appear
image

For a potential hint for debugging, I maximally zoomed out and I pasted screenshot on to xournalpp paper and moved screenshot by mouse drag, and it seems like this situation easily creates crash.

The log is as following

Date: Thu Jan 13 18:22:14 2022
Error: signal 11
[bt]: (0) xournalpp(+0x1ee244) [0x55cca4d01244]
[bt]: (1) /lib/x86_64-linux-gnu/libc.so.6(+0x46210) [0x7feb0b799210]
[bt]: (2) xournalpp(_ZN11XojPageView10getXournalEv+0x4) [0x55cca4c808d4]
[bt]: (3) xournalpp(_ZN13EditSelection13handleEdgePanEPS_+0x49) [0x55cca4c461d9]
[bt]: (4) /lib/x86_64-linux-gnu/libglib-2.0.so.0(+0x52be8) [0x7feb0ccfbbe8]
[bt]: (5) /lib/x86_64-linux-gnu/libglib-2.0.so.0(g_main_context_dispatch+0x14e) [0x7feb0ccfb04e]
[bt]: (6) /lib/x86_64-linux-gnu/libglib-2.0.so.0(+0x52400) [0x7feb0ccfb400]
[bt]: (7) /lib/x86_64-linux-gnu/libglib-2.0.so.0(g_main_context_iteration+0x33) [0x7feb0ccfb4a3]
[bt]: (8) /lib/x86_64-linux-gnu/libgio-2.0.so.0(g_application_run+0x205) [0x7feb0c146fe5]
[bt]: (9) xournalpp(_ZN11XournalMain3runEiPPc+0x4af) [0x55cca4bf6b7f]
[bt]: (10) /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf3) [0x7feb0b77a0b3]
[bt]: (11) xournalpp(_start+0x2e) [0x55cca4bd48be]


Try to get a better stracktrace...
[bt] #1 xournalpp(+0x1ee719) [0x55cca4d01719]
??:0
[bt] #2 /lib/x86_64-linux-gnu/libc.so.6(+0x46210) [0x7feb0b799210]
??:0
[bt] #3 xournalpp(_ZN11XojPageView10getXournalEv+0x4) [0x55cca4c808d4]
??:0
[bt] #4 xournalpp(_ZN13EditSelection13handleEdgePanEPS_+0x49) [0x55cca4c461d9]
??:0
[bt] #5 /lib/x86_64-linux-gnu/libglib-2.0.so.0(+0x52be8) [0x7feb0ccfbbe8]
??:0
[bt] #6 /lib/x86_64-linux-gnu/libglib-2.0.so.0(g_main_context_dispatch+0x14e) [0x7feb0ccfb04e]
??:0
[bt] #7 /lib/x86_64-linux-gnu/libglib-2.0.so.0(+0x52400) [0x7feb0ccfb400]
??:0
[bt] #8 /lib/x86_64-linux-gnu/libglib-2.0.so.0(g_main_context_iteration+0x33) [0x7feb0ccfb4a3]
??:0
[bt] #9 /lib/x86_64-linux-gnu/libgio-2.0.so.0(g_application_run+0x205) [0x7feb0c146fe5]
??:0
[bt] #10 xournalpp(_ZN11XournalMain3runEiPPc+0x4af) [0x55cca4bf6b7f]
??:0
[bt] #11 /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf3) [0x7feb0b77a0b3]
??:0
[bt] #12 xournalpp(_start+0x2e) [0x55cca4bd48be]
??:0

@youngminpark2559
Copy link

youngminpark2559 commented Jan 13, 2022

@rolandlo And I observed additional situation where the warning message of edge panning shows and no crash
It seems like this edge panning warning appeared when I started the xournalpp "file/path/name.xopp"
image

@rolandlo
Copy link
Member Author

@rolandlo And I observed additional situation where the warning message of edge panning shows and no crash It seems like this edge panning warning appeared when I started the xournalpp "file/path/name.xopp" image

You got that message almost two minutes after starting xournalpp from the terminal. It looks unrelated to me.

@youngminpark2559
Copy link

@rolandlo Yes, but above message (#3704 (comment)) is the situation where I encountered the crash without edge panning warning on the new installed xournalpp. Since the crash was not captured by edge panning exception, could that crash have occured regardless of edge panning? Hope that report helps.

@rolandlo
Copy link
Member Author

@LittleHuba @bhennion Does anyone of you understand why handleEdgePan can still segfault on self->view->getXournal(), although I added the check that self->view is not null? Is this a multithreading issue?

@bhennion
Copy link
Contributor

I have only given this a glance, but yes, it could definitely be a data race issue (handleEdgePan being a timer callback function, we do not know which thread is calling it).

I imagine it could be triggered by

EditSelection::~EditSelection() {
finalizeSelection();
this->sourcePage = nullptr;
this->sourceLayer = nullptr;
delete this->contents;
this->contents = nullptr;
this->view = nullptr;
this->undo = nullptr;
if (this->edgePanHandler) {
g_source_destroy(this->edgePanHandler);
g_source_unref(this->edgePanHandler);
}
}

The view pointer is set to nullptr before killing the timer, and without ensuring the callback function is not running.

Also I don't really understand how the crash is triggered. Do we have an identified reproducible input sequence that (even only sometimes) leads to the crash?

@youngminpark2559
Copy link

youngminpark2559 commented Jan 16, 2022

@bhennion @rolandlo I don't know when the crash exactly happen. Following is the environment and task where I get the crash

  1. I use large paper size like 60cm x 60cm

  2. I capture image into clipboard and paste it onto xournalpp page.

  3. I generally maximally zoom out to arrange screen captures

  4. I move already selected screen capture from the pasting by using mouse drag with selected capture image

  5. I do "2." multiple times, upto using 3 or 4 xournalpp pages like following
    2022_01_16_15:47:08

  6. When I move selected image, or when I click other area to unselect image, or when I press ctrl+p to use pen, or when I press ctrl+s to save the state, it seems like the crash (termination of the app) happen at those moments

@LittleHuba
Copy link
Member

Add a check for Nullpointer into the respective function and attach a debugger to the positive path of the check. Then try to trigger the bug. The backtrack in the debugger will tell you what constellation of threads causes it.

@Technius
Copy link
Member

To identify the issue, I think we should insert some debug prints in the destructor and setEdgePan, so we get a console log like

created handler (setEdgePan)
callback
callback
callback
removed handler (setEdgePan)
created handler (setEdgePan)
callback
callback
removed handler (destructor)

If we end up with a sequence like

created handler (setEdgePan)
callback
removed handler (destructor)
callback

this would help a lot towards identifying the cause.

Also, I think there is an issue in setEdgePan:

} else if (!pan && this->edgePanHandler) {
g_source_unref(this->edgePanHandler);
this->edgePanHandler = nullptr;
this->edgePanInhibitNext = false;

should also insert g_source_destroy before the unref to cancel the source in the glib main loop (see this link).

@Technius
Copy link
Member

This is blocking the 1.1.1 release, so for now, I will (in a few days) create a separate PR that allows edge panning to be disabled in the settings (and also incorporate the fix for the issue I identified above). Hopefully that will allow @youngminpark2559 and other people to work around the issue in the meantime.

@Technius Technius added this to the v1.1.1 milestone Jan 31, 2022
@rolandlo
Copy link
Member Author

rolandlo commented Feb 7, 2022

Closing in favor of #3776.

@rolandlo rolandlo closed this Feb 7, 2022
@rolandlo rolandlo deleted the fix-edge-panning-crash branch February 7, 2022 13:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants