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

Segfault at begin of CLI rendering #5107

Closed
psilhavy opened this issue Jul 31, 2019 · 6 comments · Fixed by #5579
Closed

Segfault at begin of CLI rendering #5107

psilhavy opened this issue Jul 31, 2019 · 6 comments · Fixed by #5579
Assignees

Comments

@psilhavy
Copy link

version

LMMS 1.2.0.495
(Linux x86_64, Qt 5.11.3, GCC 9.1.0)
from git.

gdb session

(gdb) r  render /home/ps/lmms/projects/1-10.mmpz -o /home/ps/lmms/projects/export/1-10.wav -f wav -s 192000 -b 320 -i sincbest -x 1
...

Thread 15 "ProjectRenderer" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7faa2a5b6700 (LWP 18310)]
0x00000000005f9910 in MidiTime::operator int() const () at /usr/src/lmms/src/core/midi/MidiTime.cpp:121
(gdb) bt
#0  0x00000000005f9910 in MidiTime::operator int() const () at /usr/src/lmms/src/core/midi/MidiTime.cpp:121
#1  0x00000000005c28be in TimeLineWidget::loopBegin (this=0x0) at /usr/src/lmms/include/TimeLineWidget.h:128
#2  Song::startExport (this=0x1725780) at /usr/src/lmms/src/core/Song.cpp:766
#3  0x00000000005b70ec in ProjectRenderer::run (this=0x68b5040) at /usr/src/lmms/include/Engine.h:77
#4  0x00007faa726488dc in ?? () from /m/qt/lib/libQt5Core.so.5
#5  0x00007faa74c51fc5 in start_thread (arg=<optimized out>) at pthread_create.c:486
#6  0x00007faa722bb7af in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
(gdb) 

No problems with GUI export.

@PhysSong
Copy link
Member

It's a regression in #4639, See #4639 (comment).
A temporary fix will look like:

diff --git a/src/core/Song.cpp b/src/core/Song.cpp
index 336aa3df2..2daaf5c03 100644
--- a/src/core/Song.cpp
+++ b/src/core/Song.cpp
@@ -763,12 +763,16 @@ void Song::startExport()
 			m_exportSongEnd += MidiTime(1,0);
         
 		m_exportSongBegin = MidiTime(0,0);
-		m_exportLoopBegin = m_playPos[Mode_PlaySong].m_timeLine->loopBegin() < m_exportSongEnd && 
-			m_playPos[Mode_PlaySong].m_timeLine->loopEnd() <= m_exportSongEnd ?
-			m_playPos[Mode_PlaySong].m_timeLine->loopBegin() : MidiTime(0,0);
-		m_exportLoopEnd = m_playPos[Mode_PlaySong].m_timeLine->loopBegin() < m_exportSongEnd && 
-			m_playPos[Mode_PlaySong].m_timeLine->loopEnd() <= m_exportSongEnd ?
-			m_playPos[Mode_PlaySong].m_timeLine->loopEnd() : MidiTime(0,0);
+		// FIXME: remove this check once we load timeline in headless mode
+		if (m_playPos[Mode_PlaySong].m_timeLine)
+		{
+			m_exportLoopBegin = m_playPos[Mode_PlaySong].m_timeLine->loopBegin() < m_exportSongEnd &&
+				m_playPos[Mode_PlaySong].m_timeLine->loopEnd() <= m_exportSongEnd ?
+				m_playPos[Mode_PlaySong].m_timeLine->loopBegin() : MidiTime(0,0);
+			m_exportLoopEnd = m_playPos[Mode_PlaySong].m_timeLine->loopBegin() < m_exportSongEnd &&
+				m_playPos[Mode_PlaySong].m_timeLine->loopEnd() <= m_exportSongEnd ?
+				m_playPos[Mode_PlaySong].m_timeLine->loopEnd() : MidiTime(0,0);
+		}
 
 		m_playPos[Mode_PlaySong].setTicks( 0 );
 	}

@psilhavy
Copy link
Author

Works well with patch. Thank you.

@PhysSong
Copy link
Member

I'll close this once this is correctly fixed in the mainstream.

@PhysSong PhysSong reopened this Jul 31, 2019
@psilhavy
Copy link
Author

Patched version segfault in GUI startup

appears randomly, more frequently without debugger. Not seen earlier.

gdb stacktrace


Thread 1 "lmms" received signal SIGSEGV, Segmentation fault.
0xfffffffffffffff0 in ?? ()
(gdb) bt
#0  0xfffffffffffffff0 in ?? ()
#1  0x000000000067caa2 in EffectView::EffectView (this=0x37f2af0, _model=0x7ffff15f0020, _parent=<optimized out>)
    at /usr/src/lmms/src/gui/widgets/EffectView.cpp:97
#2  0x000000000067a73e in EffectRackView::update (this=0x194aa00) at /usr/src/lmms/src/gui/widgets/EffectRackView.cpp:170
#3  0x00007ffff5b2a3c3 in QMetaObject::activate(QObject*, int, int, void**) () from /m/qt/lib/libQt5Core.so.5
#4  0x00000000005682ea in EffectChain::loadSettings (this=0x99da00, _this=...) at /usr/src/lmms/src/core/EffectChain.cpp:116
#5  0x00000000005c18f2 in SerializingObject::restoreState (this=0x99da20, element=...)
    at /usr/src/lmms/src/core/SerializingObject.cpp:70
#6  0x0000000000573ccc in FxMixer::loadSettings (this=0xe487a0, _this=...) at /m/qt/include/QtCore/qstring.h:693
#7  0x00000000005c18f2 in SerializingObject::restoreState (this=0xe487c0, element=...)
    at /usr/src/lmms/src/core/SerializingObject.cpp:70
#8  0x0000000000583fa9 in JournallingObject::restoreState (this=this@entry=0xe487c0, _this=...)
    at /usr/src/lmms/src/core/JournallingObject.cpp:90
#9  0x00000000005c5fd8 in Song::loadProject (this=0xe431d0, fileName=...) at /usr/src/lmms/include/Engine.h:72
#10 0x0000000000502f4b in main (argc=<optimized out>, argv=<optimized out>) at /usr/src/lmms/include/Engine.h:77
(gdb) 

@PhysSong
Copy link
Member

Patched version segfault in GUI startup

That looks quite unrelated. Do you use a custom template project for the startup project?

@psilhavy
Copy link
Author

Tried some ancient project (reopened at startup) which 100% was not based on custom template, random crashes persists .

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 a pull request may close this issue.

2 participants