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

Dragging the position fader back in song editor causes crash #4956

Closed
Jikstra opened this issue Apr 22, 2019 · 5 comments · Fixed by #4966
Closed

Dragging the position fader back in song editor causes crash #4956

Jikstra opened this issue Apr 22, 2019 · 5 comments · Fixed by #4966
Milestone

Comments

@Jikstra
Copy link

Jikstra commented Apr 22, 2019

LMMS Version: 1.2.0-rc8

In case you need the project file (does this also need the samples...?) i can upload that of course.

btw: last time i used lmms was a couple of years ago, really nice progress :)

@PhysSong
Copy link
Member

Do you mean the playback position line, a vertical line with a triangle? Also, could you upload the project file?

@Jikstra
Copy link
Author

Jikstra commented Apr 23, 2019

Yes it's the playback position line. I'm getting a segmentation fault. It's not that easy anymore to reproduce the problem, maybe i changed something in the project. It still happens, but it needs some more (fast?) dragging around of the playback position line. I think what's important is dragging the playback position to the beginning of the song, maybe even further. Oh and i have to play the song a bit, doing it right after it played doesn't make this crash happen.

Here is a video of me reproducing it: https://streamable.com/9vow0

The project file: uno.zip

@PhysSong
Copy link
Member

Confirmed. Here's part of the stack trace:

#0  0x00005555556d13d4 in PlayHandle::PlayHandle(PlayHandle::Types, int) ()
#1  0x00005555556c9d5e in NotePlayHandle::NotePlayHandle(InstrumentTrack*, int, int, Note const&, NotePlayHandle*, int, NotePlayHandle::Origins) ()
#2  0x00005555556ca2f2 in NotePlayHandleManager::acquire(InstrumentTrack*, int, int, Note const&, NotePlayHandle*, int, NotePlayHandle::Origins) ()
#3  0x000055555569de6e in InstrumentFunctionNoteStacking::processNote(NotePlayHandle*) ()
#4  0x0000555555802a09 in InstrumentTrack::playNote(NotePlayHandle*, float (*) [2]) ()
#5  0x00005555556c9736 in NotePlayHandle::play(float (*) [2]) ()

For some reason this is null in the constructor, I'm going to investigate this issue.

@Jikstra
Copy link
Author

Jikstra commented Apr 23, 2019

Thanks for helping and that fast replying!

@PhysSong
Copy link
Member

Okay, I found the reason.
When stacking or arpeggio is turned on, the mixer worker thread creates a new NotePlayHandle for sub-notes. Since there are multiple instruments with stacking enabled, Multiple worker threads may call NotePlayHandleManager::acquire simultaneously.

However, NotePlayHandleManager::acquire only uses read lock unless the pool is empty. It means two threads may try to take one from the pool if there's the only one available.

if( s_availableIndex < 0 )
{
s_mutex.lockForWrite();
if( s_availableIndex < 0 ) extend( NPH_CACHE_INCREMENT );
s_mutex.unlock();
}
s_mutex.lockForRead();
NotePlayHandle * nph = s_available[ s_availableIndex.fetchAndAddOrdered( -1 ) ];
s_mutex.unlock();

I guess #4443 may fix this issue, but that's for future versions(likely 1.3.0 or so). I will try to find a way to address this issue for 1.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants