tildearrow / furnace

a multi-system chiptune tracker compatible with DefleMask modules
GNU General Public License v2.0
2.57k stars 206 forks source link

Segmentation fault (when reconnecting display?) #1927

Closed sergi0g closed 3 months ago

sergi0g commented 4 months ago

Background

Furnace version: 0.6.3 (Flatpak) Operating System: Ubuntu 23.10

When leaving my computer, some times I turn off the monitor to save power.

Problem

When turning my monitor back on, Furnace is no longer open. Any file I had open, is lost. If I have unsaved work, I'll lose it.

Expected behavior

When turning my monitor back on, Furnace should remain open and work properly.

Troubleshooting

To further investigate what is going on, I launched furnace with flatpak run org.tildearrow.furnace so I can view logs. I used the application for a bit and made sure everything was ok. Then, I started playing a file in Furnace and turned off my monitor for a while. While my monitor was, off Furnace was playing the song. During that time my computer was unlocked. Once I turned my monitor back on, the music abruptly stopped and Furnace exited. Here are the last few lines of the log:

[trace] window exposed
[debug] display 0 disconnected!
[trace] updateWindow is true
[trace] updating scrConf
[trace] restoring swap interval...
Stack trace (most recent call last):
#7    Object "[0xffffffffffffffff]", at 0xffffffffffffffff, in 
#6    Object "furnace", at 0x64ed8c196654, in _start
#5    Object "/usr/lib/x86_64-linux-gnu/libc.so.6", at 0x7d49be03b14a, in __libc_start_main
#4    Object "/usr/lib/x86_64-linux-gnu/libc.so.6", at 0x7d49be03b089, in 
#3    Object "furnace", at 0x64ed8c18ca70, in main
#2    Object "furnace", at 0x64ed8c70a5c5, in FurnaceGUI::loop()
#1    Object "furnace", at 0x64ed8c720d53, in FurnaceGUIRenderGL::present()
#0    Object "/app/lib/libSDL2-2.0.so.0", at 0x7d49be95e1db, in 
Segmentation fault (Address not mapped to object [0x3c])

Further troubleshooting by recording my screen shows that the "display 0 disconnected" message appears when I turn on my monitor, which explains the fact that music continued to play while it was off. I am unfamiliar with C++, but I think you may be trying to use some object referring to the previous display? I hope this helps you figure out what's wrong. If you need more info, I'll be glad to help debug!

tildearrow commented 4 months ago

Oh no... possible SDL issue...

Can you test using the Linux release in the Releases page?

sergi0g commented 4 months ago

Thanks for the quick reply! I tried the Linux build and there are no problems. The log looks like this:

[debug] display 0 disconnected!
[debug] display 0 connected!
[trace] updateWindow is true
[trace] updating scrConf
[trace] restoring swap interval...

Seems to be an issue with the Flatpak. Time for more debugging! For my first test, I set the Flatpak permissions to only access Wayland, which my OS is running by default. I tried and it exited when I turned the monitor on again. In my second test, I set the permissions to only the X socket and it worked without any problems.

It seems Wayland may be breaking something. The peculiar thing is that while by default Furnace can access both X and Wayland (in both Flatpak and non-Flatpak versions), it seems to choose Wayland in Flatpak and X (XWayland?) on my host. Also (probably irrelevant): when I changed the Flatpak to only access X, drag and drop stopped working.

tildearrow commented 4 months ago

Could be an issue with the Flatpak version of SDL indeed...