C-Kenny / music-visualizer-4-friend

Music Visualizer, written in Processing 3
GNU General Public License v3.0
4 stars 0 forks source link

Visualizer sometimes fails to re-open song again #10

Closed C-Kenny closed 4 years ago

C-Kenny commented 5 years ago

The visualizer appears to play the song the first time, but sometimes it can't play the same song again in quick succession.

Leading to errors like:

getsockopt(): Bad file descriptor

and

Assertion 'pa_close(m->fd) == 0' failed at pulsecore/shm.c:288, function pa_shm_free(). Aborting.
Could not run the sketch (Target VM failed to initialize).
For more information, read revisions.txt and Help → Troubleshooting

and

RunnableTask.run(): A caught exception occured on thread main-Display-.x11_:0.0-1-EDT-1: RunnableTask[enqueued true[executed false, flushed false], tTotal 0 ms, tExec 0 ms, tQueue 0 ms, attachment null, throwable java.lang.RuntimeException: Waited 5000ms for: <606b9b77, 2bb22bf5>[count 2, qsz 1, owner <main-FPSAWTAnimator#00-Timer0>] - <main-Display-.x11_:0.0-1-EDT-1>]
java.lang.RuntimeException: Waited 5000ms for: <606b9b77, 2bb22bf5>[count 2, qsz 1, owner <main-FPSAWTAnimator#00-Timer0>] - <main-Display-.x11_:0.0-1-EDT-1>
    at jogamp.common.util.locks.RecursiveLockImpl01Unfairish.lock(RecursiveLockImpl01Unfairish.java:198)
    at jogamp.newt.WindowImpl$ResizableAction.run(WindowImpl.java:2118)
    at jogamp.newt.DisplayImpl.runOnEDTIfAvail(DisplayImpl.java:450)
    at jogamp.newt.WindowImpl.runOnEDTIfAvail(WindowImpl.java:2782)
    at jogamp.newt.WindowImpl.setResizable(WindowImpl.java:2154)
    at com.jogamp.newt.opengl.GLWindow.setResizable(GLWindow.java:370)
    at processing.opengl.PSurfaceJOGL$5.run(PSurfaceJOGL.java:452)
    at com.jogamp.common.util.RunnableTask.run(RunnableTask.java:127)
    at jogamp.newt.DefaultEDTUtil$NEDT.run(DefaultEDTUtil.java:375)
DefaultEDT.run(): Caught exception occured on thread main-Display-.x11_:0.0-1-EDT-1: RunnableTask[enqueued false[executed true, flushed false], tTotal 5001 ms, tExec 5001 ms, tQueue 0 ms, attachment null, throwable java.lang.RuntimeException: Waited 5000ms for: <606b9b77, 2bb22bf5>[count 2, qsz 1, owner <main-FPSAWTAnimator#00-Timer0>] - <main-Display-.x11_:0.0-1-EDT-1>]
java.lang.RuntimeException: Waited 5000ms for: <606b9b77, 2bb22bf5>[count 2, qsz 1, owner <main-FPSAWTAnimator#00-Timer0>] - <main-Display-.x11_:0.0-1-EDT-1>
    at jogamp.common.util.locks.RecursiveLockImpl01Unfairish.lock(RecursiveLockImpl01Unfairish.java:198)
    at jogamp.newt.WindowImpl$ResizableAction.run(WindowImpl.java:2118)
    at jogamp.newt.DisplayImpl.runOnEDTIfAvail(DisplayImpl.java:450)
    at jogamp.newt.WindowImpl.runOnEDTIfAvail(WindowImpl.java:2782)
    at jogamp.newt.WindowImpl.setResizable(WindowImpl.java:2154)
    at com.jogamp.newt.opengl.GLWindow.setResizable(GLWindow.java:370)
    at processing.opengl.PSurfaceJOGL$5.run(PSurfaceJOGL.java:452)
    at com.jogamp.common.util.RunnableTask.run(RunnableTask.java:127)
    at jogamp.newt.DefaultEDTUtil$NEDT.run(DefaultEDTUtil.java:375)
java.lang.RuntimeException: Waited 5000ms for: <606b9b77, 2bb22bf5>[count 2, qsz 0, owner <main-FPSAWTAnimator#00-Timer0>] - <main-FPSAWTAnimator#00-Timer0-FPSAWTAnimator#00-Timer1>
    at processing.opengl.PSurfaceJOGL$2.run(PSurfaceJOGL.java:410)
    at java.lang.Thread.run(Thread.java:748)
RuntimeException: Waited 5000ms for: <606b9b77, 2bb22bf5>[count 2, qsz 0, owner <main-FPSAWTAnimator#00-Timer0>] - <main-FPSAWTAnimator#00-Timer0-FPSAWTAnimator#00-Timer1>

and

cb_connection_has_error() returned true
mmap() failed: Bad file descriptor
getsockopt(): Bad file descriptor
xcb_connection_has_error() returned true
Invalid shared memory segment size
Failed to create permanent mapping for memfd region with ID = 3067716039
Failed to regester memfd mempool. Reason: could not attach memfd SHM ID to pipe
IllegalArgumentException: Mixer not supported: default [default], version 4.19.0-5-amd64

Closing the visualizer and waiting ~60s seems to resolve this. Thinking the file may remain open when though it's supposed to close() upon exit.

C-Kenny commented 5 years ago

I've added a safe exit keyboard shortcut as 'x'/'X' which tries to close safely and stop minim from having the file open but I still sometimes get this error.

C-Kenny commented 5 years ago

Running $ lsof ~/Music/Visualizer/<song_title> we can see that sometimes Processing itself still holds onto the file. Even when seemingly not using it..

C-Kenny commented 5 years ago

This is the last knowing commit where this bug didn't occur: https://github.com/C-Kenny/music-visualizer-4-friend/commit/a0cbe98396a52277c75a9b5e03d53509b2573a2e