xournalpp / xournalpp

Xournal++ is a handwriting notetaking software with PDF annotation support. Written in C++ with GTK3, supporting Linux (e.g. Ubuntu, Debian, Arch, SUSE), macOS and Windows 10. Supports pen input from devices such as Wacom Tablets.
https://xournalpp.github.io
GNU General Public License v2.0
10.66k stars 782 forks source link

Frequent crashes while recording audio #1568

Open nicolae-stroncea opened 4 years ago

nicolae-stroncea commented 4 years ago

OS

Bug Description

Occurs seemingly randomly while i'm annotating a PDF, and crashes can occur very frequently, i.e as often as every 2 minutes.

Here are some error logs: errorlog.20191023-114820.log errorlog.20191023-114401.log errorlog.20191023-114246.log errorlog.20191023-113406.log

morrolinux commented 4 years ago

Same here today. I'll try launching from command line to provide additional context

ghost commented 4 years ago

Same here :

I receive the following in my log

`sunny@sunny-Surface-Book:~$ xournalpp ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side ALSA lib pcm_route.c:867:(find_matching_chmap) Found no matching channel map ALSA lib pcm_route.c:867:(find_matching_chmap) Found no matching channel map ALSA lib pcm_route.c:867:(find_matching_chmap) Found no matching channel map ALSA lib pcm_route.c:867:(find_matching_chmap) Found no matching channel map Cannot connect to server socket err = No such file or directory Cannot connect to server request channel jack server is not running or cannot be started JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock

(xournalpp:13038): Gtk-WARNING : 22:57:16.655: Could not load image 'pixmaps/xournalpp.svg': Failed to open file '/usr/bin/../share/xournalpp//ui/pixmaps/xournalpp.svg': No such file or directory Message: 22:57:26.113: Start recording ** Message: 22:58:17.277: Stop recording ALSA lib pcm.c:8306:(snd_pcm_recover) underrun occurred

(xournalpp:13038): WARNING : 22:58:38.751: PortAudioConsumer: PortAudio reported a stream warning: 4

(xournalpp:13038): WARNING : 22:58:38.752: PortAudioConsumer: PortAudio reported a stream warning: 4 double free or corruption (out)`

Technius commented 4 years ago

@nicolae-stroncea Does this issue occur with the official 1.0.15 release?

@ChemicalNameOfTitin Can you provide your OS version, PortAudio version, and Xournal++ commit id?

nicolae-stroncea commented 4 years ago

@Technius I'll run it for a couple of days with 1.0.15 and will let you know if same thing occurs. I ran Xournal++ from terminal for some more details on the bug so far(note this is still for version at commit #1529 ):

Here are some things that may or may not be relevant: I typically record fairly long recordings for my lecture(1- 2 hours). The recordings and the xournal files themselves are saved on a fat32 partition, which is not home.

ALSA lib pcm_dmix.c:1108:(snd_pcm_dmix_open) unable to open slave
ALSA lib pcm.c:2564:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2564:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2564:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm_route.c:869:(find_matching_chmap) Found no matching channel map
ALSA lib pcm_dmix.c:1108:(snd_pcm_dmix_open) unable to open slave
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock

(xournalpp:23731): Gtk-CRITICAL **: 15:24:06.263: gtk_widget_queue_resize: assertion 'GTK_IS_WIDGET (widget)' failed

** (xournalpp:23731): WARNING **: 15:24:06.295: Error calculating zoom value
** Message: 15:24:20.083: lastOpenPath set
** Message: 15:24:20.084: Filename: /dir/373f19-L7.pdf.xopp
** Message: 15:24:21.196: Start recording
** Message: 15:27:06.470: Info: autosave document...
** Message: 15:27:06.470: Autosaving to /dir/.373f19-L7.pdf.autosave.xopp
** Message: 15:30:06.470: Info: autosave document...
** Message: 15:30:06.471: Autosave renamed from /dir/.373f19-L7.pdf.autosave.xopp to /home/nick/.xournalpp/autosave/23731.old.autosave.xopp
** Message: 15:30:06.479: Autosaving to /dir/.373f19-L7.pdf.autosave.xopp
** Message: 15:33:06.470: Info: autosave document...
** Message: 15:33:06.471: Autosave renamed from /dir/.373f19-L7.pdf.autosave.xopp to /home/nick/.xournalpp/autosave/23731.old.autosave.xopp
** Message: 15:33:06.481: Autosaving to /dir/.373f19-L7.pdf.autosave.xopp
** Message: 15:39:06.471: Info: autosave document...
** Message: 15:39:06.473: Autosave renamed from /dir/.373f19-L7.pdf.autosave.xopp to /home/nick/.xournalpp/autosave/23731.old.autosave.xopp
** Message: 15:39:06.478: Autosaving to /dir/.373f19-L7.pdf.autosave.xopp
** Message: 15:42:06.471: Info: autosave document...
** Message: 15:42:06.473: Autosave renamed from /dir/.373f19-L7.pdf.autosave.xopp to /home/nick/.xournalpp/autosave/23731.old.autosave.xopp
** Message: 15:42:06.481: Autosaving to /dir/.373f19-L7.pdf.autosave.xopp
** Message: 15:45:06.470: Info: autosave document...
** Message: 15:45:06.471: Autosave renamed from /dir/.373f19-L7.pdf.autosave.xopp to /home/nick/.xournalpp/autosave/23731.old.autosave.xopp
** Message: 15:45:06.482: Autosaving to /dir/.373f19-L7.pdf.autosave.xopp

** (xournalpp:23731): WARNING **: 15:45:15.871: DocumentView::drawStroke empty stroke...

** (xournalpp:23731): WARNING **: 15:46:32.378: DocumentView::drawStroke empty stroke...

** (xournalpp:23731): WARNING **: 15:46:32.485: Stroke incomplete!
** Message: 15:48:06.470: Info: autosave document...
** Message: 15:48:06.471: Autosave renamed from /dir/.373f19-L7.pdf.autosave.xopp to /home/nick/.xournalpp/autosave/23731.old.autosave.xopp
** Message: 15:48:06.480: Autosaving to /dir/.373f19-L7.pdf.autosave.xopp

** (xournalpp:23731): WARNING **: 15:49:47.777: DocumentView::drawStroke empty stroke...

** (xournalpp:23731): WARNING **: 15:49:47.868: Stroke incomplete!
** Message: 15:51:06.475: Info: autosave document...
** Message: 15:51:06.476: Autosave renamed from /dir/.373f19-L7.pdf.autosave.xopp to /home/nick/.xournalpp/autosave/23731.old.autosave.xopp
** Message: 15:51:06.486: Autosaving to /dir/.373f19-L7.pdf.autosave.xopp
** Message: 15:54:06.470: Info: autosave document...
** Message: 15:54:06.471: Autosave renamed from /dir/.373f19-L7.pdf.autosave.xopp to /home/nick/.xournalpp/autosave/23731.old.autosave.xopp
** Message: 15:54:06.481: Autosaving to /dir/.373f19-L7.pdf.autosave.xopp
** Message: 15:57:06.470: Info: autosave document...
** Message: 15:57:06.478: Autosave renamed from /dir/.373f19-L7.pdf.autosave.xopp to /home/nick/.xournalpp/autosave/23731.old.autosave.xopp
** Message: 15:57:06.487: Autosaving to /dir/.373f19-L7.pdf.autosave.xopp
xournalpp: src/hostapi/alsa/pa_linux_alsa.c:3636: PaAlsaStreamComponent_BeginPolling: Assertion `ret == self->nfds' failed.

** (xournalpp:23731): WARNING **: 15:57:22.426: [Crash Handler] Crashed with signal 6

** (xournalpp:23731): WARNING **: 15:57:22.429: [Crash Handler] Wrote crash log to: /home/nick/.xournalpp/errorlogs/errorlog.20191024-155722.log

** (xournalpp:23731): WARNING **: 15:57:22.831: Trying to emergency save the current open document…

** (xournalpp:23731): WARNING **: 15:57:22.837: Successfully saved document to "/home/nick/.xournalpp//emergencysave.xopp"
ghost commented 4 years ago

@Technius How can I find them out? I'm quite new to Ubuntu sorry,

I'm using Ubuntu 18.04 LTS, the official repo for xournalpp and I'm assuming the latest version of Portaudio because I run apt-get update/upgrade fairly frequently.

Technius commented 4 years ago

@nicolae-stroncea I took a look at your logs. This might be a PortAudio bug, but I'm not sure. Some people have been having similar issues in other applications. @LittleHuba might be able to come up with a workaround for this issue.

@ChemicalNameOfTitin Knowing that you're using Ubuntu 18.04 LTS is actually enough (you can find the git commit id in Xournal++ under Help > About) . Your crash seems unrelated to this issue. Can you submit another ticket with both your console output and your crash log (found in ~/.xournalpp/errorlogs)?

LittleHuba commented 4 years ago

Hmm did not yet see this bug. I think we will not be able to fix it within X++. The callback is already as short as possible to minimize any gaps in audio. I think this is something that PortAudio itself needs to fix. You should upvote the issue and offer your help for further debugging.

morrolinux commented 4 years ago

I know it's not much, but for now I've just noticed it doesn't crash at all on my old branch (pre-merge state with circular buffer and stuff) while it does on the master branch. I've had no time to debug this further but that leads me to think it might actually be a xournalpp bug rather than a PortAudio bug.

double free or corruption (out)`

This line in particular is what's bothering me: same error as the crash during playback with the audio stack like structure

LittleHuba commented 4 years ago

If it is could you try to triage it @morrolinux? It has to be a deletion or some pointer arithmetic that is wrong, since those create these errors.

morrolinux commented 4 years ago

triage

I'm sorry what do you mean by that?

LittleHuba commented 4 years ago

Triaging is the term for trying to find where exactly the bug originiates from so we can devise a fix.

Maybe valgrind helps with finding what is exactly freed twice or what memory part is corrupted. The error does not appear on my machine so I can't really fix it.

morrolinux commented 4 years ago

Yeah sure, of course I can't test it during classes or I'll risk losing important data, so I'll have to try in my spare time :)