libretro / RetroArch

Cross-platform, sophisticated frontend for the libretro API. Licensed GPLv3.
http://www.libretro.com
GNU General Public License v3.0
10.4k stars 1.84k forks source link

RetroArch crashes when Saving States with Sync to Exact Content Framerate Enabled #10576

Open protopizza opened 4 years ago

protopizza commented 4 years ago

First and foremost consider this:

Description

I have under video synchronization options "Sync to Exact Content Framerate Enabled" set to ON. I have neither G-Sync nor FreeSync enabled (someone suggested I enable this option to try to fix netplay rollback issues). When I try to save state with Savestate Thumbnails ON, RetroArch crashes. The savestate still gets created, RetroArch just crashes with no warning. This only crashes if there is an existing savestate in the slot.

This might be related to #10521, but they were primarily discussing widgets, and enabling/disabling widgets had no effect here.

Expected behavior

RetroArch doesn't crash in the above scenario. If a screenshot thumbnail is unable to be taken, display an error, but don't crash. It took me some time to realize the cause of this behavior.

Actual behavior

RetroArch crashes.

Steps to reproduce the bug

  1. Already have a savestate in slot.
  2. Set Video->Synchronization->Sync to Exact Content Framerate Enabled to ON. (G-Sync/FreeSync not supported)
  3. Set Saving->Savestate Thumbnails to ON.
  4. Load content.
  5. Go to quick menu, and save state.
  6. RetroArch crashes, though the savestate is still made.

Bisect Results

This seems almost certainly due to "Sync to Exact Content Framerate Enabled" causing screenshots to fail, which in turn causes RetroArch to crash. I'm using the 1.8.5 stable build currently.

Version/Commit

You can find this information under Information/System Information

Environment information

snaphat commented 4 years ago

I can confirm this is still an issue with 1.8.9 stable. It only occurs with the vulkan driver enabled (GL works fine for example). As the OP said, It definitely doesn't matter if freesync/gsync is enabled in the video driver settings (newest stable Nvidia driver in my case, but the issue showed up with the prior driver as well).

It specifically has to do with having the vrr_runloop_enable setting enabled (which is enabled via the "Sync to Exact Content Framerate Enabled" setting in the GUI).

I was able to reproduce the crashes on nestopia, fceumm, and snes9x cores, but not with genesis_plus_gx and vba_next. So it's only certain cores that cause crashes.

Crash debug log:

-------------------
Error occurred on Friday, June 26, 2020 at 20:36:46.

retroarch_debug.exe caused an Access Violation at location 00007FFC2E442A9E in module nvoglv64.dll Reading from location 0000000000000068.

AddrPC           Params
00007FFC2E442A9E 0000000019D82990 000000000A3EF960 0000000000000000  nvoglv64.dll!vkGetInstanceProcAddr
00000000007B69F2 0000000010E3C360 0000000022229040 0000000000000000  retroarch_debug.exe!vulkan_read_viewport  [C:/msys64/home/buildbot/buildbot/windows_x64/retroarch/gfx/drivers/vulkan.c @ 2611]
000000000043C8CA 0000000022229040 0000000000000000 0000000000000000  retroarch_debug.exe!video_driver_read_viewport  [C:/msys64/home/buildbot/buildbot/windows_x64/retroarch/retroarch.c @ 30288]
00000000004BB15D 0000000010DE115C 000000001C8016F0 000000000A3EFB01  retroarch_debug.exe!take_screenshot_viewport  [C:/msys64/home/buildbot/buildbot/windows_x64/retroarch/tasks/task_screenshot.c @ 445]
00000000004BB402 0000000010DE115C 000000001C8016F0 000000000A3EFB01  retroarch_debug.exe!take_screenshot_choice  [C:/msys64/home/buildbot/buildbot/windows_x64/retroarch/tasks/task_screenshot.c @ 524]
00000000004BB661 0000000010DE115C 000000001C8016F0 000000001C801C01  retroarch_debug.exe!take_screenshot  [C:/msys64/home/buildbot/buildbot/windows_x64/retroarch/tasks/task_screenshot.c @ 577]
000000000046839D 000000001C801C00 0000000012D2F290 0000000000000000  retroarch_debug.exe!save_state_cb  [C:/msys64/home/buildbot/buildbot/windows_x64/retroarch/tasks/task_save.c @ 1100]
000000000045EAE4 0000000019D817F0 0000001B196EBF25 0100000000000005  retroarch_debug.exe!retro_task_internal_gather  [C:/msys64/home/buildbot/buildbot/windows_x64/retroarch/libretro-common/queues/task_queue.c @ 162]
000000000045F0F6 0000001200000011 0000000800000010 000000000A3EFD30  retroarch_debug.exe!retro_task_threaded_gather  [C:/msys64/home/buildbot/buildbot/windows_x64/retroarch/libretro-common/queues/task_queue.c @ 399]
000000000045F7E3 0000000001266060 0000000000000000 000000000A3EFD30  retroarch_debug.exe!task_queue_check  [C:/msys64/home/buildbot/buildbot/windows_x64/retroarch/libretro-common/queues/task_queue.c @ 658]
000000000041D6E9 0000000000000001 00000000000C0000 0000000000000000  retroarch_debug.exe!rarch_main  [C:/msys64/home/buildbot/buildbot/windows_x64/retroarch/retroarch.c @ 16002]
00000000005B6367 0000000000000001 00000000000C0000 00000000000E3CB8  retroarch_debug.exe!SDL_main  [C:/msys64/home/buildbot/buildbot/windows_x64/retroarch/ui/drivers/qt/ui_qt_application.cpp @ 151]
0000000000AE276E 0000000000000000 0000000000000068 0000000001A83C80  retroarch_debug.exe!main_getcmdline
00000000004013B4 0000000000000000 0000000000000000 0000000000000000  retroarch_debug.exe!__tmainCRTStartup  [E:/mingwbuild/mingw-w64-crt-git/src/mingw-w64/mingw-w64-crt/crt/crtexe.c @ 339]
00000000004014DB 0000000000000000 0000000000000000 0000000000000000  retroarch_debug.exe!WinMainCRTStartup  [E:/mingwbuild/mingw-w64-crt-git/src/mingw-w64/mingw-w64-crt/crt/crtexe.c @ 195]
00007FFC6F186FD4 0000000000000000 0000000000000000 0000000000000000  KERNEL32.DLL!BaseThreadInitThunk
00007FFC6FABCEC1 0000000000000000 0000000000000000 0000000000000000  ntdll.dll!RtlUserThreadStart

retroarch_debug.exe
ntdll.dll       10.0.19041.207
KERNEL32.DLL    10.0.19041.292
KERNELBASE.dll  10.0.19041.292
ADVAPI32.dll    10.0.19041.1
msvcrt.dll      7.0.19041.1
sechost.dll     10.0.19041.1
RPCRT4.dll      10.0.19041.1
comdlg32.dll    10.0.19041.329
combase.dll     10.0.19041.329
ucrtbase.dll    10.0.19041.1
shcore.dll      10.0.19041.264
USER32.dll      10.0.19041.264
win32u.dll      10.0.19041.329
GDI32.dll       10.0.19041.1
gdi32full.dll   10.0.19041.329
msvcp_win.dll   10.0.19041.1
SHLWAPI.dll     10.0.19041.1
SHELL32.dll     10.0.19041.329
COMCTL32.dll    5.82.19041.1
ole32.dll       10.0.19041.153
SETUPAPI.dll    10.0.19041.1
DINPUT8.dll     10.0.19041.1
cfgmgr32.dll    10.0.19041.1
DSOUND.dll      10.0.19041.1
HID.DLL         10.0.19041.1
bcrypt.dll      10.0.19041.1
WS2_32.dll      10.0.19041.1
IPHLPAPI.DLL    10.0.19041.1
MSIMG32.dll     10.0.19041.264
libwinpthread-1.dll 1.0.0.0
OPENGL32.dll    10.0.19041.1
powrprof.dll    10.0.19041.1
winmmbase.dll   10.0.19041.1
WINMM.dll       10.0.19041.1
libass-9.dll
libstdc++-6.dll
avutil-56.dll   56.31.100.0
libcaca-0.dll
avformat-58.dll 58.29.100.0
avcodec-58.dll  58.54.100.0
cg.dll          3.1.0.13
cgD3D9.dll      3.1.0.13
cgGL.dll        3.1.0.13
exchndl.dll     0.9.2.0
PSAPI.DLL       10.0.19041.1
libfreetype-6.dll   2.10.1.0
Qt5Core.dll     5.13.2.0
libopenal-1.dll
Qt5Network.dll  5.13.2.0
CRYPT32.dll     10.0.19041.21
libssl-1_1-x64.dll  1.1.1.4
SDL2.dll        2.0.10.0
IMM32.dll       10.0.19041.1
swresample-3.dll    3.5.100.0
OLEAUT32.dll    10.0.19041.329
swscale-5.dll   5.5.100.0
libusb-1.0.dll  1.0.23.11397
GLU32.dll       10.0.19041.1
libfontconfig-1.dll
libfribidi-0.dll
libharfbuzz-0.dll
libgcc_s_seh-1.dll
libmfx-1.dll
zlib1.dll
libbluray-2.dll
libbz2-1.dll
libmodplug-1.dll
librtmp-1.dll
libsrt.dll
libcelt0-2.dll
libgsm.dll
liblzma-5.dll   5.2.4.0
libmp3lame-0.dll
libopencore-amrnb-0.dll
libopus-0.dll
libspeex-1.dll
libtheoradec-1.dll
libtheoraenc-1.dll
libvorbis-0.dll
libvorbisenc-2.dll
libvpx-1.dll
libwavpack-1.dll
libwebp-7.dll
libwebpmux-3.dll
libx264-157.dll 0.157.2970.0
mgwhelp.dll     0.9.2.0
VERSION.dll     10.0.19041.1
libpng16-16.dll
MPR.dll         10.0.19041.1
USERENV.dll     10.0.19041.1
NETAPI32.dll    10.0.19041.1
libicuuc65.dll
libpcre2-16-0.dll
libzstd.dll
libcrypto-1_1-x64.dll   1.1.1.4
DNSAPI.dll      10.0.19041.1
libexpat-1.dll
libintl-8.dll   0.19.8.0
USP10.dll       10.0.19041.1
libgraphite2.dll
libgmp-10.dll
libxml2-2.dll
libhogweed-5.dll
WSOCK32.dll     10.0.19041.1
libogg-0.dll
dbghelp.dll     10.0.19041.1
dbgcore.DLL     10.0.19041.1
Qt5Gui.dll      5.13.2.0
Qt5Widgets.dll  5.13.2.0
libiconv-2.dll  1.16.0.0
libgnutls-30.dll
libopencore-amrwb-0.dll
libopenjp2-7.dll
libx265.dll     3.2.0.1
xvidcore.dll
libdouble-conversion.dll
libicuin65.dll
libglib-2.0-0.dll   2.62.2.0
libnettle-7.dll
libicudt65.dll
dwmapi.dll      10.0.19041.1
UxTheme.dll     10.0.19041.1
libidn2-0.dll
libtasn1-6.dll
CRYPTBASE.DLL   10.0.19041.1
NETUTILS.DLL    10.0.19041.1
SRVCLI.DLL      10.0.19041.1
libp11-kit-0.dll
libpcre-1.dll
libunistring-2.dll  0.9.10.0
libffi-6.dll
UMPDC.dll
ncrypt.dll      10.0.19041.1
NTASN1.dll      10.0.19041.1
CRYPTSP.dll     10.0.19041.1
rsaenh.dll      10.0.19041.1
bcryptPrimitives.dll    10.0.19041.264
NSI.dll         10.0.19041.1
inputhost.dll   10.0.19041.264
wintypes.dll    10.0.19041.329
CoreMessaging.dll   10.0.19041.264
PROPSYS.dll     7.0.19041.1
CoreUIComponents.dll    10.0.19041.1
ntmarta.dll     10.0.19041.1
kernel.appcore.dll  10.0.19041.1
A-Volute.SonicRadar3DevProps2.dll   2.5.0.62864
NahimicOSD.dll  2.1.19.63261
ProductInfo.dll
A-Volute.SonicStudio3DevProps2.dll  2.5.0.62864
dxgi.dll        10.0.19041.1
nvoglv64.dll    27.21.14.5148
WTSAPI32.dll    10.0.19041.1
DEVOBJ.dll      10.0.19041.1
WINTRUST.dll    10.0.19041.1
MSASN1.dll      10.0.19041.1
graphics-hook64.dll 1.1.4.0
dxcore.dll      10.0.19041.1
windows.storage.dll 10.0.19041.329
Wldp.dll        10.0.19041.1
nvspcap64.dll   3.20.3.63
profapi.dll     10.0.19041.1
MSCTF.dll       10.0.19041.329
cryptnet.dll    10.0.19041.1
imagehlp.dll    10.0.19041.1
gpapi.dll       10.0.19041.329
NvCameraWhitelisting64.dll  7.0.600.0
nvapi64.dll     27.21.14.5148
WINSTA.dll      10.0.19041.1
textinputframework.dll  10.0.19041.1
xinput1_4.dll   10.0.19041.1
clbcatq.dll     2001.12.10941.16384
explorerframe.dll   10.0.19041.329
XAudio2_7.dll   9.29.1962.0
MMDevApi.dll    10.0.19041.1
AudioSes.dll    10.0.19041.264
ProductInfo.dll
resourcepolicyclient.dll    10.0.19041.1
Windows.UI.dll  10.0.19041.264
WindowManagementAPI.dll
twinapi.appcore.dll 10.0.19041.264
avrt.dll        10.0.19041.1
wdmaud.drv      10.0.19041.1
ksuser.dll      10.0.19041.1
msacm32.drv     10.0.19041.1
MSACM32.dll     10.0.19041.1
midimap.dll     10.0.19041.1
uiautomationcore.dll    7.2.19041.153
OLEACC.dll      7.2.19041.1
fceumm_libretro.dll
vulkan-1.dll    1.2.131.2
mswsock.dll     10.0.19041.1
fwpuclnt.dll    10.0.19041.1
rasadhlp.dll    10.0.19041.1

Windows 10.0.19041
DrMingw 0.9.2
snaphat commented 4 years ago

Seems to be the same issue referenced here: https://github.com/libretro/RetroArch/issues/8361