[GH-ISSUE #4512] delayed segfault on loading savestate in fl0w #1845

Closed
opened 2026-03-18 04:20:56 +03:00 by kerem · 20 comments
Owner

Originally created by @i30817 on GitHub (Nov 11, 2013).
Original GitHub issue: https://github.com/hrydgard/ppsspp/issues/4512

wait 10 seconds or so, for the 'transformation' to end.

https://drive.google.com/file/d/0BzxkBmaf1EiWcDR4MGkyWXppSjg/edit?usp=sharing

Originally created by @i30817 on GitHub (Nov 11, 2013). Original GitHub issue: https://github.com/hrydgard/ppsspp/issues/4512 wait 10 seconds or so, for the 'transformation' to end. https://drive.google.com/file/d/0BzxkBmaf1EiWcDR4MGkyWXppSjg/edit?usp=sharing
kerem closed this issue 2026-03-18 04:21:01 +03:00
Author
Owner

@unknownbrackets commented on GitHub (Nov 19, 2013):

It seems like this is related to ATRAC3+ decoding. It doesn't crash at all without the savestate?

-[Unknown]

<!-- gh-comment-id:28769447 --> @unknownbrackets commented on GitHub (Nov 19, 2013): It seems like this is related to ATRAC3+ decoding. It doesn't crash at all without the savestate? -[Unknown]
Author
Owner

@i30817 commented on GitHub (Nov 19, 2013):

Not that i could tell. It was just pure luck (ok lots of savescumming) that i saved before the crash.

<!-- gh-comment-id:28770315 --> @i30817 commented on GitHub (Nov 19, 2013): Not that i could tell. It was just pure luck (ok lots of savescumming) that i saved before the crash.
Author
Owner

@i30817 commented on GitHub (Dec 9, 2013):

Uploaded the save to my google drive since i was worried about mediafire deleting it
https://drive.google.com/file/d/0BzxkBmaf1EiWcDR4MGkyWXppSjg/edit?usp=sharing

<!-- gh-comment-id:30149091 --> @i30817 commented on GitHub (Dec 9, 2013): Uploaded the save to my google drive since i was worried about mediafire deleting it https://drive.google.com/file/d/0BzxkBmaf1EiWcDR4MGkyWXppSjg/edit?usp=sharing
Author
Owner

@unknownbrackets commented on GitHub (Jan 30, 2014):

Does this still happen since the ffmpeg update?

-[Unknown]

<!-- gh-comment-id:33702286 --> @unknownbrackets commented on GitHub (Jan 30, 2014): Does this still happen since the ffmpeg update? -[Unknown]
Author
Owner

@i30817 commented on GitHub (Jan 30, 2014):

Yes. I debugged it and got this out:
Program received signal SIGSEGV, Segmentation fault.
0x0000000000ac2341 in ff_atrac3p_generate_tones (ch_unit=,
fdsp=0x23b03e0, ch_num=, sb=,
out=) at libavcodec/atrac3plusdsp.c:199
199 libavcodec/atrac3plusdsp.c: No such file or directory.
(gdb)

(complete backtrace is useless btw, lots of #1 0x8000000080ac1c18 in ?? () lines, i don't know why)
I suppose i should build a debug version of the included ffmpeg too? Apparently it isn't built by cmake but distributed already built?

edit: from this code apparently, if i found the right file:
ffmpeg/libavcodec/atrac3plusdsp.c

if (tones_now->pend_env.has_stop_point &&
    tones_now->pend_env.stop_pos >= tones_next->curr_env.start_pos) {
<!-- gh-comment-id:33704130 --> @i30817 commented on GitHub (Jan 30, 2014): Yes. I debugged it and got this out: Program received signal SIGSEGV, Segmentation fault. 0x0000000000ac2341 in ff_atrac3p_generate_tones (ch_unit=<optimized out>, fdsp=0x23b03e0, ch_num=<optimized out>, sb=<optimized out>, out=<optimized out>) at libavcodec/atrac3plusdsp.c:199 199 libavcodec/atrac3plusdsp.c: No such file or directory. (gdb) (complete backtrace is useless btw, lots of #1 0x8000000080ac1c18 in ?? () lines, i don't know why) I suppose i should build a debug version of the included ffmpeg too? Apparently it isn't built by cmake but distributed already built? edit: from this code apparently, if i found the right file: ffmpeg/libavcodec/atrac3plusdsp.c ``` if (tones_now->pend_env.has_stop_point && tones_now->pend_env.stop_pos >= tones_next->curr_env.start_pos) { ```
Author
Owner

@i30817 commented on GitHub (Jan 30, 2014):

If you could reduce this to a test case and punt it to Max it would probably be fixed.
If that is, it isn't the fault of the save state saving or something.

<!-- gh-comment-id:33721553 --> @i30817 commented on GitHub (Jan 30, 2014): If you could reduce this to a test case and punt it to Max it would probably be fixed. If that is, it isn't the fault of the save state saving or something.
Author
Owner

@unknownbrackets commented on GitHub (Jan 30, 2014):

Oh, you probably need to rebuild ffmpeg. I don't think the distributed one was updated yet.

Just go in there are run ./linux_x86-64.sh (or ./linux_x86.sh as the case may be.)

-[Unknown]

<!-- gh-comment-id:33730797 --> @unknownbrackets commented on GitHub (Jan 30, 2014): Oh, you probably need to rebuild ffmpeg. I don't think the distributed one was updated yet. Just go in there are run `./linux_x86-64.sh` (or `./linux_x86.sh` as the case may be.) -[Unknown]
Author
Owner

@i30817 commented on GitHub (Jan 31, 2014):

It gives a few deprecation warnings and a full blown undefined reference later:
edit: user error, see next post
edit2: it wasn't :(
/home/i30817/Documents/Netbeans_projects/ppsspp/ffmpeg/linux/x86_64/lib/libavcodec.a(mpegvideo_enc.o): In function ff_dct_encode_init': /home/i30817/Documents/Netbeans_projects/ppsspp/ffmpeg/libavcodec/mpegvideo_enc.c:229: undefined reference toff_h263dsp_init'
/home/i30817/Documents/Netbeans_projects/ppsspp/ffmpeg/linux/x86_64/lib/libavcodec.a(h263dec.o): In function ff_h263_decode_init': /home/i30817/Documents/Netbeans_projects/ppsspp/ffmpeg/libavcodec/h263dec.c:127: undefined reference toff_h263dsp_init'
collect2: error: ld returned 1 exit status
make[2]: *** [PPSSPPSDL] Error 1
make[1]: *** [CMakeFiles/PPSSPPSDL.dir/all] Error 2
make: *** [all] Error 2

adding #include "h263dsp.h", which contains the definition,
on those files but it did nothing useful for some reason, maybe it's wrong. Error only occurs when linking PPSSPPSDL, not before, when building ffmpeg with the linux_x86-64.sh... but those files are all libavcodec.a ones.

<!-- gh-comment-id:33750994 --> @i30817 commented on GitHub (Jan 31, 2014): It gives a few deprecation warnings and a full blown undefined reference later: edit: user error, see next post edit2: it wasn't :( /home/i30817/Documents/Netbeans_projects/ppsspp/ffmpeg/linux/x86_64/lib/libavcodec.a(mpegvideo_enc.o): In function `ff_dct_encode_init': /home/i30817/Documents/Netbeans_projects/ppsspp/ffmpeg/libavcodec/mpegvideo_enc.c:229: undefined reference to`ff_h263dsp_init' /home/i30817/Documents/Netbeans_projects/ppsspp/ffmpeg/linux/x86_64/lib/libavcodec.a(h263dec.o): In function `ff_h263_decode_init': /home/i30817/Documents/Netbeans_projects/ppsspp/ffmpeg/libavcodec/h263dec.c:127: undefined reference to`ff_h263dsp_init' collect2: error: ld returned 1 exit status make[2]: **\* [PPSSPPSDL] Error 1 make[1]: **\* [CMakeFiles/PPSSPPSDL.dir/all] Error 2 make: **\* [all] Error 2 adding #include "h263dsp.h", which contains the definition, on those files but it did nothing useful for some reason, maybe it's wrong. Error only occurs when linking PPSSPPSDL, not before, when building ffmpeg with the linux_x86-64.sh... but those files are all libavcodec.a ones.
Author
Owner

@unknownbrackets commented on GitHub (Jan 31, 2014):

Try removing the mjpeg encoder:
github.com/hrydgard/ppsspp-ffmpeg@5037e36273 (commitcomment-5177869)

-[Unknown]

<!-- gh-comment-id:33755975 --> @unknownbrackets commented on GitHub (Jan 31, 2014): Try removing the mjpeg encoder: https://github.com/hrydgard/ppsspp-ffmpeg/commit/5037e3627327907d989f83fa595041a84e9f2f9e#commitcomment-5177869 -[Unknown]
Author
Owner

@i30817 commented on GitHub (Jan 31, 2014):

I actually suspect something like this:
http://cmake.3232098.n2.nabble.com/static-library-linking-problem-td7584444.html

It would make sense if it tried to access those functions as if it was C++ and they're actually mangled as C. So building in the sh file gives no prob, and trying to verify the functions in the C++ linker of static files blows up although they're all inside the same .a file.

To be clear, what you're suggest there is revert that commit or what?

<!-- gh-comment-id:33756198 --> @i30817 commented on GitHub (Jan 31, 2014): I actually suspect something like this: http://cmake.3232098.n2.nabble.com/static-library-linking-problem-td7584444.html It would make sense if it tried to access those functions as if it was C++ and they're actually mangled as C. So building in the sh file gives no prob, and trying to verify the functions in the C++ linker of static files blows up although they're all inside the same .a file. To be clear, what you're suggest there is revert that commit or what?
Author
Owner

@unknownbrackets commented on GitHub (Jan 31, 2014):

Well, it could also be that our flags are wrong and we're not ending up with the h263 funcs we need in the library, which we would only get an error about at link time.

-[Unknown]

<!-- gh-comment-id:33756256 --> @unknownbrackets commented on GitHub (Jan 31, 2014): Well, it could also be that our flags are wrong and we're not ending up with the h263 funcs we need in the library, which we would only get an error about at link time. -[Unknown]
Author
Owner

@i30817 commented on GitHub (Jan 31, 2014):

Well i sincerely don't feel like i'm able to resolve this myself. How would i go about disabling mjpeg like you said?

edit: in the sh file, i see

<!-- gh-comment-id:33758001 --> @i30817 commented on GitHub (Jan 31, 2014): Well i sincerely don't feel like i'm able to resolve this myself. How would i go about disabling mjpeg like you said? edit: in the sh file, i see
Author
Owner

@i30817 commented on GitHub (Jan 31, 2014):

Well removing --enable-encoder=mjpeg didn't fully resolve it but one of the errors went away. This still remains:
/home/i30817/Documents/Netbeans_projects/ppsspp/ffmpeg/linux/x86_64/lib/libavcodec.a(h263dec.o): In function ff_h263_decode_init': /home/i30817/Documents/Netbeans_projects/ppsspp/ffmpeg/libavcodec/h263dec.c:127: undefined reference toff_h263dsp_init'
collect2: error: ld returned 1 exit status

trying to removing ffv1 for good measure now.
edit: nope

<!-- gh-comment-id:33758327 --> @i30817 commented on GitHub (Jan 31, 2014): Well removing --enable-encoder=mjpeg didn't fully resolve it but one of the errors went away. This still remains: /home/i30817/Documents/Netbeans_projects/ppsspp/ffmpeg/linux/x86_64/lib/libavcodec.a(h263dec.o): In function `ff_h263_decode_init': /home/i30817/Documents/Netbeans_projects/ppsspp/ffmpeg/libavcodec/h263dec.c:127: undefined reference to`ff_h263dsp_init' collect2: error: ld returned 1 exit status trying to removing ffv1 for good measure now. edit: nope
Author
Owner
<!-- gh-comment-id:33758732 --> @i30817 commented on GitHub (Jan 31, 2014): http://www.ffmpeg.org/faq.html#I_0027m-using-FFmpeg-from-within-my-C-application-but-the-linker-complains-about-missing-symbols-from-the-libraries-themselves_002e either 4.8 or 4.9 which parts of PPSSPP use ffmpeg includes?
Author
Owner

@i30817 commented on GitHub (Jan 31, 2014):

Never mind, i found them with a grep. I'm going to try to put in the extern "C" thing around those and rebuild to see what's what.

edit: they're all already extern "C". All i found with this grep at least:
grep -R --exclude-dir=ffmpeg* "#include" . | grep 'libavcodec/|libavformat/|libswresample/|libswscale/|libavutil'

<!-- gh-comment-id:33760920 --> @i30817 commented on GitHub (Jan 31, 2014): Never mind, i found them with a grep. I'm going to try to put in the extern "C" thing around those and rebuild to see what's what. edit: they're all already extern "C". All i found with this grep at least: grep -R --exclude-dir=ffmpeg\* "#include" . | grep 'libavcodec/|libavformat/|libswresample/|libswscale/|libavutil'
Author
Owner

@unknownbrackets commented on GitHub (Jan 31, 2014):

Well, the undefined reference is from within ffmpeg, so that means it's nothing to do with PPSSPP or C++, most likely.

It could be link order, I suppose, but it worked before, right?

It seems likely to me that something isn't getting compiled and put into the library, but I don't know what/why.

You could try removing "--disable-all" from the sh. ffmpeg will be bigger but maybe it will work.

-[Unknown]

<!-- gh-comment-id:33761724 --> @unknownbrackets commented on GitHub (Jan 31, 2014): Well, the undefined reference is from _within ffmpeg_, so that means it's nothing to do with PPSSPP or C++, most likely. It could be link order, I suppose, but it worked before, right? It seems likely to me that something isn't getting compiled and put into the library, but I don't know what/why. You could try removing "--disable-all" from the sh. ffmpeg will be bigger but maybe it will work. -[Unknown]
Author
Owner

@i30817 commented on GitHub (Jan 31, 2014):

Removing the --disable-everything appears to have worked for building.
And the bug is fixed. That is, there is a conspicuous lack of sound when it would crash before, but it's not crashing anymore and the game recovers the sound just a second later anyway. In neither debug or normal builds.

Closed!

<!-- gh-comment-id:33762421 --> @i30817 commented on GitHub (Jan 31, 2014): Removing the --disable-everything appears to have worked for building. And the bug is fixed. That is, there is a conspicuous lack of sound when it would crash before, but it's not crashing anymore and the game recovers the sound just a second later anyway. In neither debug or normal builds. Closed!
Author
Owner

@unknownbrackets commented on GitHub (Jan 31, 2014):

Hmm, well, there's something wrong there but tbh I'm pretty sure we have other bugs that cover the general issue. Glad it works now.

We need to figure out that ffmpeg mess...

-[Unknown]

<!-- gh-comment-id:33763151 --> @unknownbrackets commented on GitHub (Jan 31, 2014): Hmm, well, there's something wrong there but tbh I'm pretty sure we have other bugs that cover the general issue. Glad it works now. We need to figure out that ffmpeg mess... -[Unknown]
Author
Owner

@i30817 commented on GitHub (Jan 31, 2014):

btw @unknownbrackets if youre curious, this is what a log enabled run of that savestate shows in the console (without the crash now) before and during the pause:
01:44:243 idle0 I[COMMON]: Common/ChunkFile.cpp:165 ChunkReader: Loading /home/i30817/.config/ppsspp/PSP/PPSSPP_STATE/NPUG80086_1.00_2.ppst
01:44:524 idle0 I[SCEGE]: GLES/Framebuffer.cpp:1632 Destroying FBO for 00088000 : 480 x 272 x 3
01:44:524 idle0 I[SCEGE]: GLES/Framebuffer.cpp:1632 Destroying FBO for 10198010 : 256 x 128 x 3
01:44:524 idle0 I[SCEGE]: GLES/Framebuffer.cpp:1632 Destroying FBO for 201b8020 : 128 x 64 x 3
01:44:524 idle0 I[SCEGE]: GLES/Framebuffer.cpp:1632 Destroying FBO for 301c0030 : 128 x 64 x 3
01:44:524 idle0 I[SCEGE]: GLES/Framebuffer.cpp:1632 Destroying FBO for 00000000 : 480 x 272 x 3
01:44:526 idle0 I[COMMON]: Common/ChunkFile.h:607 ChunkReader: Done loading /home/i30817/.config/ppsspp/PSP/PPSSPP_STATE/NPUG80086_1.00_2.ppst
01:44:548 swap thread I[SCEGE]: GLES/Framebuffer.cpp:794 Creating FBO for 00088000 : 480 x 272 x 3
01:44:548 swap thread I[SCEGE]: GLES/Framebuffer.cpp:794 Creating FBO for 10198010 : 256 x 128 x 3
01:44:548 swap thread W[SCEGE]: GLES/Framebuffer.cpp:814 FBO reusing depthbuffer, 10198010/00110000 and 00088000/00110000
01:44:548 swap thread I[SCEGE]: GLES/Framebuffer.cpp:794 Creating FBO for 201b8020 : 128 x 64 x 3
01:44:548 swap thread W[SCEGE]: GLES/Framebuffer.cpp:814 FBO reusing depthbuffer, 201b8020/00110000 and 00088000/00110000
01:44:549 swap thread I[SCEGE]: GLES/Framebuffer.cpp:794 Creating FBO for 301c0030 : 128 x 64 x 3
01:44:549 swap thread W[SCEGE]: GLES/Framebuffer.cpp:814 FBO reusing depthbuffer, 301c0030/00110000 and 00088000/00110000
01:44:694 swap thread I[SCEGE]: GLES/Framebuffer.cpp:794 Creating FBO for 00000000 : 480 x 272 x 3
01:45:494 stream threa I[ME]: HLE/sceAtrac.cpp:973 sceAtracReleaseAtracID(1)
01:53:105 stream threa I[ME]: HW/MediaEngine.cpp:84 FF: Invalid gain location: ch=0, sb=1, pos=2, val=32
01:53:105 stream threa E[ME]: HLE/sceAtrac.cpp:608 avcodec_decode_audio4: Error decoding audio -1094995529
01:53:105 stream threa E[ME]: HLE/sceAtrac.cpp:818 UNIMPL sceAtracGetInternalErrorInfo(0, 09fdc254)
01:53:105 stream threa I[ME]: HLE/sceAtrac.cpp:973 sceAtracReleaseAtracID(0)
01:53:242 stream threa I[ME]: HLE/sceAtrac.cpp:1272 0=sceAtracSetDataAndGetID(089d5340, 00020000)
01:53:242 stream threa W[ME]: HLE/sceAtrac.cpp:1162 This is an atrac3+ stereo audio

<!-- gh-comment-id:33765567 --> @i30817 commented on GitHub (Jan 31, 2014): btw @unknownbrackets if youre curious, this is what a log enabled run of that savestate shows in the console (without the crash now) before and during the pause: 01:44:243 idle0 I[COMMON]: Common/ChunkFile.cpp:165 ChunkReader: Loading /home/i30817/.config/ppsspp/PSP/PPSSPP_STATE/NPUG80086_1.00_2.ppst 01:44:524 idle0 I[SCEGE]: GLES/Framebuffer.cpp:1632 Destroying FBO for 00088000 : 480 x 272 x 3 01:44:524 idle0 I[SCEGE]: GLES/Framebuffer.cpp:1632 Destroying FBO for 10198010 : 256 x 128 x 3 01:44:524 idle0 I[SCEGE]: GLES/Framebuffer.cpp:1632 Destroying FBO for 201b8020 : 128 x 64 x 3 01:44:524 idle0 I[SCEGE]: GLES/Framebuffer.cpp:1632 Destroying FBO for 301c0030 : 128 x 64 x 3 01:44:524 idle0 I[SCEGE]: GLES/Framebuffer.cpp:1632 Destroying FBO for 00000000 : 480 x 272 x 3 01:44:526 idle0 I[COMMON]: Common/ChunkFile.h:607 ChunkReader: Done loading /home/i30817/.config/ppsspp/PSP/PPSSPP_STATE/NPUG80086_1.00_2.ppst 01:44:548 swap thread I[SCEGE]: GLES/Framebuffer.cpp:794 Creating FBO for 00088000 : 480 x 272 x 3 01:44:548 swap thread I[SCEGE]: GLES/Framebuffer.cpp:794 Creating FBO for 10198010 : 256 x 128 x 3 01:44:548 swap thread W[SCEGE]: GLES/Framebuffer.cpp:814 FBO reusing depthbuffer, 10198010/00110000 and 00088000/00110000 01:44:548 swap thread I[SCEGE]: GLES/Framebuffer.cpp:794 Creating FBO for 201b8020 : 128 x 64 x 3 01:44:548 swap thread W[SCEGE]: GLES/Framebuffer.cpp:814 FBO reusing depthbuffer, 201b8020/00110000 and 00088000/00110000 01:44:549 swap thread I[SCEGE]: GLES/Framebuffer.cpp:794 Creating FBO for 301c0030 : 128 x 64 x 3 01:44:549 swap thread W[SCEGE]: GLES/Framebuffer.cpp:814 FBO reusing depthbuffer, 301c0030/00110000 and 00088000/00110000 01:44:694 swap thread I[SCEGE]: GLES/Framebuffer.cpp:794 Creating FBO for 00000000 : 480 x 272 x 3 01:45:494 stream threa I[ME]: HLE/sceAtrac.cpp:973 sceAtracReleaseAtracID(1) 01:53:105 stream threa I[ME]: HW/MediaEngine.cpp:84 FF: Invalid gain location: ch=0, sb=1, pos=2, val=32 01:53:105 stream threa E[ME]: HLE/sceAtrac.cpp:608 avcodec_decode_audio4: Error decoding audio -1094995529 01:53:105 stream threa E[ME]: HLE/sceAtrac.cpp:818 UNIMPL sceAtracGetInternalErrorInfo(0, 09fdc254) 01:53:105 stream threa I[ME]: HLE/sceAtrac.cpp:973 sceAtracReleaseAtracID(0) 01:53:242 stream threa I[ME]: HLE/sceAtrac.cpp:1272 0=sceAtracSetDataAndGetID(089d5340, 00020000) 01:53:242 stream threa W[ME]: HLE/sceAtrac.cpp:1162 This is an atrac3+ stereo audio
Author
Owner

@i30817 commented on GitHub (Jan 31, 2014):

i've noticed the sound crackles too. But i guess that is another bug.

<!-- gh-comment-id:33765632 --> @i30817 commented on GitHub (Jan 31, 2014): i've noticed the sound crackles too. But i guess that is another bug.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ppsspp#1845
No description provided.