binogure-studio / city-game-studio-i18n

Translation files for City Game Studio
https://www.city-game-studio.com
51 stars 102 forks source link

Bug: Stuck and then system user logout during game play #847

Closed y2-Whyto closed 1 year ago

y2-Whyto commented 1 year ago

Describe the bug

After clicking the create button on the main interface, when selecting a category (game engine, contract, etc.) on the left side of the pop-up menu, the game occasionally freezes. Trackpad gestures, keyboard unresponsive, but the mouse pointer can move and show different shapes on different buttons (no response when clicked).

After being stuck for more than ten seconds, the system user logs out, and the system user login interface is displayed. After logging in, it is the same as the user re-login (all previously opened applications need to be restarted). During the whole above period, there was no error prompt, and no system error report was generated after the system user logged in again.

To Reproduce

This is an occasional bug, which may happen when doing the selection of category rapidly after the creation menu pops up. Not sure. This happens in multiple occasions.

Expected behavior

Not stuck

Logs

Attach log files to this ticket: (I tried a few times playing the game and this "crash" happened several times.) citygamestudio-0.log citygamestudio-1.log citygamestudio-2.log citygamestudio-3.log citygamestudio-4.log citygamestudio-5.log citygamestudio-6.log citygamestudio-7.log

Screenshots

None

Desktop

Additional context

Actually this seems to happen to any window with category selection. I'm not quite sure how it can be reproduced, but it happens sometimes when I make selections in game windows (mostly in the Create menu).

y2-Whyto commented 1 year ago

UPDATE:

Just now I tried again playing it. This time the game caused system logout suddenly during the game play (the instant before it "crash"ed I didn't do anything, like clicking or something else).

Here are the new/updated logs for your reference:

citygamestudio-7.log citygamestudio-8.log citygamestudio-9.log

The time of the log files 8(possibly) and 9 is when I logged in again after the "crash".

xsellier commented 1 year ago

Hey,

Thank you for that feedback. I optimized the game today, I hope it'll help your computer running the game. To try it out, you need to switch to the unstable Steam branch.

Open Steam, right click on City Game Studio, Properties, Betas then select unstable.

I keep this ticket open till the bug is fixed

y2-Whyto commented 1 year ago

Hey,

Thank you for that feedback. I optimized the game today, I hope it'll help your computer running the game. To try it out, you need to switch to the unstable Steam branch.

Open Steam, right click on City Game Studio, Properties, Betas then select unstable.

I keep this ticket open till the bug is fixed

Thank you for your reply. However, this bug hasn't been fixed yet.

Just now I tried playing the game, and it crashed at 01:42(UTC+8) when I finished reading an e-mail in the game and trying closing the window. Here are the updated logs during the game play for your reference:

citygamestudio-1.log citygamestudio-2.log citygamestudio-3.log

(Log File 3 is a file generated after system user re-login)

xsellier commented 1 year ago

Hey,

I got your log files, thank you for sharing them. To be honest, you encountered a new bug, still a crash, but there's progress!

I'm sorry about all of this, and Im doing my best to fix em all!

xsellier commented 1 year ago

Meanwhile, I enabled more logs for MacOS so I can better understand what's going on on your computer. Log files should have more details about crash.

y2-Whyto commented 1 year ago

Hello @xsellier ,

Just now I updated the unstable version and played it again. This time the game crashed after I clicked the close button of "Gem Con 90". Below the close window there should be the "Game Reviews" of my newly released "game", which actually didn't have time to pop up before the game lost response. The "Gem Con 90" and the "Game Reviews" part seemed to meet each other closely at the same time.

These are the new game logs. I started playing at about 14:22 and it crashed at about 14:29:

citygamestudio-4.log citygamestudio-5.log citygamestudio-6.log

xsellier commented 1 year ago

Hey,

Thank you for this update. I've been busy rewriting the resource loader algorithm. I think everything comes from it, so I hope this new version helps you run the game smoothly.

Keep me updated please

y2-Whyto commented 1 year ago

Hello @xsellier ,

I tried again just now with the latest unstable version. Here are the new logs(two periods, both crashed):

  1. citygamestudio-7.log citygamestudio-8.log

  2. citygamestudio-9.log citygamestudio-0.log

I can't remember the context clearly because I dealt with some personal matters after that, sorry. However, if you need more information, please tell me so that I can test it again.

xsellier commented 1 year ago

Hey,

So, I've been working on fixing those bug this morning. Found out old code that was trying to load fonts by its own way. I refactored it to use the font_manager system.

To be clear, I'm trying to reproduce the very same bug on my side, but the game runs like a charm even for long period. Meaning I'm trying to fix a bug blidly, let's hope this fix is the right one! (rc7)

y2-Whyto commented 1 year ago

Hello @xsellier ,

Thank you for your hard work these days. Though the game crashed again with the newest unstable version this time, I recorded my game play video which I'm not sure if it would be useful (it froze at the last few seconds when I tried to choose offices):

https://youtu.be/aHc_Wk9FCmo

This time I used my iPad as the second monitor and tried to save the video recording before the game "crash". What's more, when it "crashed" I also checked the Activity Monitor and found that there was no memory pressure on my mac device. So I sampled and spindump (I don't know what that means actually) the game by the way and here are the sampled files if you need:

After that I noticed the game was not unresponsive from the dock and could be normally quit, so I quit it after I had done the above work. What's weird was that the frozen screen of the main monitor didn't disappear after the game had been quit, with the mouse pointer noticeable on it while moving (in the first place it was not moving or clicking when the game froze this time, but the second monitor was not affected). Also, it didn't trigger system user logout when I did the above work on my second monitor. So I also sampled the system process "WindowServer" in Activity Monitor (see below), and I reckon this might be relevant to some system bug?

Also, here are the game logs this time (see below). Log 2 was another crash experience when I didn't manage to record a video (I didn't connect my second monitor and remembered the wrong shortcuts so no video was saved). The "crash" behavior remain the same as the "crash"es before (freeze and system user logout). Log 4 is the game play I mainly talk about in the above descriptions (continuous freeze but no system user logout).

I also remember that when I was playing the stable version in the beginning, if I de-select "Auto-adjust" in "Graphical settings" of "Options" and check "Low settings" the game could normally run and quit without issues. I don't know what's the difference in the game behaviors or if it could be a hint for your debugging.

Thank you for your patience and diligent work again. Please tell me if you need more information.

y2-Whyto commented 1 year ago

Also I upgraded to macOS Ventura 13.2 today before I played the game (formerly it was 13.1). As you mentioned you could play the game flawlessly, do we share the same spec? I guess maybe our processors and GPU differs and play the most important roles in reproducing this bug.

xsellier commented 1 year ago

Hey,

Thank you for sharing all those informations. I run the game on low settings, meaning it does not auto-adjust itself. Otherwise it drops FPS.

I'm gonna have a look at those options, and publish another udpate later today (or within 2 days)

y2-Whyto commented 1 year ago

Hey @xsellier ,

Just now I played the latest unstable version (rc9) with "Auto-adjust" on, and this time I can apparently feel it run more smoothly. This time I didn't record any video which is proven wise now or it would be too long. After over 1 hour game play, the game froze like before, when I was trying dragging the scroll bar of a certain window in the game. (I don't remember clearly, maybe a window of my custom under-development platform?)

Below is the log file. I remember it froze at about 14:30.

citygamestudio-7.log

If you feel it's necessary or helpful to record a video, please tell me. And I'll provide one each time from then on.

xsellier commented 1 year ago

Hey,

Got your feedback, and I think this new version should be the one!

Finger crossed!

y2-Whyto commented 1 year ago

Hello @xsellier ,

Thanks for your new update. Unfortunately this update didn't keep running for a long time (~10mins) before it got crashed in a similar way. This time the crash happened when I try to select a candidate for GOTY, before which I remember maybe I was about to open the Stuff window.

Here are the log files:

citygamestudio-1.log

Hope it's helpful for your debugging.

xsellier commented 1 year ago

Hey,

I'm really sorry for that crash again (logout/login). Those logs ain't useful since the game doesn't crash actually. It'd be better to get a record of the crash tho.

Do you mind recording your screen till it crash then share it please? I need to see the logout/login.

Thank you.

y2-Whyto commented 1 year ago

Hey,

I'm really sorry for that crash again (logout/login). Those logs ain't useful since the game doesn't crash actually. It'd be better to get a record of the crash tho.

Do you mind recording your screen till it crash then share it please? I need to see the logout/login.

Thank you.

Hello @xsellier ,

Do you mean you need to see the system logout and login screen in the video?

If so, I'll use my phone to record my screen next time.

xsellier commented 1 year ago

yes please!

y2-Whyto commented 1 year ago

Hey @xsellier ,

I've recorded a game play video with my phone (it's now ready):

https://youtu.be/1ZBHRPjicVE

The game froze at about 01:18:20, which I've labeled in my video.

The log file this time (I don't know if it would be helpful):

citygamestudio-4.log

Also, I need to mention last time I didn't check the "Auto-adjust" option nor the others in that column (totally 4 options). This time I checked "Auto-adjust", and the game play time extended significantly, but it still ended triggering system logout.

xsellier commented 1 year ago

Hey,

Thank you for sharing that video. Pretty useful, I made some changes in the game. The rc11 should work better.

Keep me updated!

y2-Whyto commented 1 year ago

Hey,

Thank you for sharing that video. Pretty useful, I made some changes in the game. The rc11 should work better.

Keep me updated!

Do I still need to record my computer screen (with my phone) in future reports if the bug behaves the same?

xsellier commented 1 year ago

Only if it crashes

y2-Whyto commented 1 year ago

Hello @xsellier ,

Today I played the latest rc12, and this time it didn't make me wait too long before it crashed. I've recorded a video of my screen using my iPad:

https://youtu.be/cdRutzA4p0g

The crash occurred at about 16:31 in the video, captions added.

Here is the log file of my game play:

citygamestudio-7.log

Hope they're helpful for your debugging.

xsellier commented 1 year ago

hey,

Thank you for this! I know what's the problem now. It comes from the Shaders. I reworked all of them lately, but some I cannot remove, for example when yo uedit a console, or for some part of the UI.

This issue comes from the graphic card. The driver crashes, and make the whole system restart the graphic stack, that's why you got those logout/login issues.

While I really want to fix this issue, the only way to fix it, is to remove all the shaders from the game. What I can do tho, is making them optionnal, the game won't look great, but it'll work at least.

y2-Whyto commented 1 year ago

Hello @xsellier ,

Thanks for your reply. However, I don't really understand the details, for I'm quite alien to game developing. Please forgive my ignorance.

It comes from the Shaders. I reworked all of them lately, but some I cannot remove, for example when yo uedit a console, or for some part of the UI.

This issue comes from the graphic card. The driver crashes, and make the whole system restart the graphic stack, that's why you got those logout/login issues.

Are Shaders a part of drivers or game engines? Is this a universal issue that many games will come across? Is this bug from Intel driver and could be solved only by their driver updates, or from some incompatibility between the game engine and the driver? Also, do you mean console editing or something else will still trigger crash even after the fix?

While I really want to fix this issue, the only way to fix it, is to remove all the shaders from the game. What I can do tho, is making them optionnal, the game won't look great, but it'll work at least.

Do you mean the Shaders option will be provided in Options or decided automatically? Will this bug be fixed from game updates?

I'll be very grateful if you could kindly take some time to answer my questions.

y2-Whyto commented 1 year ago

Hello @xsellier ,

Is rc13 a version with the Shader fix? Just now I tried it with "Auto Adjust" on, and it froze and triggered system logout after over 2 hours game play.

The moment it froze I was dragging a landscape bar of the third developing phase of my "big" game, and the way it "crash"ed remain the same to my two previous video clips. I don't know if that developing adjusting interface is also affected with Shader issues.

Here is a screenshot to help you understand where I am talking about:

Picture

I don't know if a game log is still useful now but here it is in case you need it:

citygamestudio-2.log

xsellier commented 1 year ago

Hey,

Sorry for the delay, I've been busy lately. Regarding your questions, shaders are visual effects used by games to make them look better. For exemple, on the city map, the seaon effect is a shader. There are a lot of shaders in every single games. Shaders are usually written in GLSL, a shading language that your graphic card is supposed to understand (has to to be honest).

Sometimes, due to poor graphic drivers, shaders might crash the graphic drivers, resulting, for mac/linux a logoff, and a blue screen for Windows.

That's why I think it's because of shadrs, but it could something else. While I really want to work on it, I have to finish something else first. It should take me, at most, something like 2 days, then I'll be back on this specific problem.

Thank yo ufor the log files, and the screenshot. Logs and the screenshot help me understand that it might not come from shaders after all, I'm not 100% sure. I'll keep digging, if you could have a crash dump it'll be easier for me to know the root cause of the crash.

y2-Whyto commented 1 year ago

Hello @xsellier ,

Glad to receive your response. You've been responsible and responsive all the time. Thank you for your answers.

I found it online that mac crash dump is at ~/Library/Logs/DiagnosticReports, where I got this file:

CityGameStudio-2023-02-09-114742.ips.zip

I noticed it was modified around the time when the game "crash"ed so I hope this is just what you need.

However, if it's not the file you need, please tell me how to get it.

xsellier commented 1 year ago

I might have a lead on the root cause. I'm looking for a solution, meanwhile you can try something on your side.

Via steam, disable the Steam overlay, it might solve the issue image

--EDIT-- I read the Steamworks SDK API, and I cannot disable it automatically, so you have to do it manually. Meaning if it works, I 'm gonna add this information on the TROUBLESHOOTING guides on Steam.

y2-Whyto commented 1 year ago

Hello @xsellier ,

Unfortunately, it still "crash"ed during the game play even after I disabled in-game Steam overlay.

This time I was clicking the close button of this window (I don't know which took place first -- my clicking or its freezing). It is a window of memory choice for my custom handheld console:

图片

Here are the log file and crash dump this time:

Note that the system logged out at about 15:03 this time, and I didn't find a file with that exact time, so I think these files in that zip are possibly the proper ones.

To help you locate the issue more conveniently, here are the modified time of the files you may need due to jet lag:

图片

By the way, if you need to know, the modified time of the .log file is 15:04.

xsellier commented 1 year ago

Hey,

Thank you for those stacks. From what I get, it seems that WindowServer has crashed, but not City Game Studio. I don't know why tho. Regarding City Game Studio, disabling the Steam overlay is a must, since that's why it crashed here https://github.com/binogure-studio/city-game-studio-i18n/issues/847#issuecomment-1424186579

More explanation, when City Game Studio crashes, the report contains something like this "exception" : {"codes":"0x0000000000000000, 0x0000000000000000","rawCodes":[0,0],"type":"EXC_CRASH","signal":"SIGABRT"}, And if I look at the stacktrace I see this gameoverlayrenderer which is the Steam overlay. That's why City Game Studio crashed in the first place.

While I'm looking at this report: https://github.com/binogure-studio/city-game-studio-i18n/issues/847#issuecomment-1425309923 I get that sentence:

"termination" : {"flags":0,"indicator":"monitoring timed out for service","code":1,"namespace":"WATCHDOG","details":["(1 monitored services unresponsive): checkin with service: WindowServer returned not alive with context:","is_alive_func returned unhealthy : Display 69734208 not ready: DisplayID: 0x4280f40","Surface Use Counts: 1(3) 3(1) 9(1)","FB RegID: 4294968665, On Glass SurfaceIDs: 9 3 1, Transactions: [ Active: SurfaceID: 9 ] [ Waiting: SurfaceID: 3 ] [ Waiting: SurfaceID: 1 ], Surface Use Counts: 160(0) 510(0) 533(0) 534(1) , Notified IsActive, has not exited since first loaded"]},

Unless you have the same ips file for City Game Studio for that crash, otherwise WindowServer crashed your computer (it seems).

y2-Whyto commented 1 year ago

Hello @xsellier ,

Thank you for your explanation. Though I got bewildered.

I don't know if there's any connection between the crash of WindowServer and the game, because there is also some description about "WindowServer" in the sentence you mentioned in the last crash dump. After all, I haven't come across this kind of bugs ever before when I played other games, like The Sims 4 from Origin. (Surely it's also probably related to issues of the system or the driver itself, I have no idea about all the above "presumptions" I said)

But the crash dump this time didn't seem to make things clear, so I'll keep trying later and report if any crash occurs. Also if you need me to do something or have some updates about this issue, just tell me.

xsellier commented 1 year ago

I'm not sure it comes from WindowsServer, and on my side I'm also working on optimizing some part of the game. There are functions that were called 80k times, every 30 seconds, I removed those calls, and Im about to publish a new RC anytime soon. As soon as this update is ready, I'm gonna tell ou here.

xsellier commented 1 year ago

Ok, I just published a new version, I don't know if it'll fix the issue. Please tell me.

y2-Whyto commented 1 year ago

Hello @xsellier ,

First I want to apologize for uploading the wrong files last time, for I looked for CGS crash dump in the system-wide DiagnosticReports folder. Just now I realized the crash dump file was actually generated in my user folder. I was so dumb and please forgive me...

Here are the last crash files:

Crash occured at ~15:03, and the Modified time of the files:

File name Modified time Size
citygamestudio-1.log 15:04, yesterday 144KB
CityGameStudio-2023-02-10-150412.ips 15:04, yesterday 19KB

As for today, I updated to rc14 and this time it didn't run for about 10 minutes before it froze. I had my mouse stopped at somewhere in this area (see the green rectangle), and as soon as the little black information window popped up, the screen froze, and the next thing you've already known.

Screenshot

And here is today's crash dump, as well as the log file:

Crash occured at ~13:19. Modified times:

File name Modified time Size
citygamestudio-4.log 13:20, today 6KB
CityGameStudio-2023-02-11-132023.ips 13:20, today 19KB

Hope they could be helpful for your debugging.

xsellier commented 1 year ago

Hey,

Thank you for those crashlog, quite usefull to be honest. Both comes from the gameoverlayrenderer.dylib library, meaning it comes from the Steam overlay renderer. Which is weird since you have disabled it.

  "asiBacktraces": [
    "0   CoreFoundation                      0x00007ff81b2443eb __exceptionPreprocess + 242
    1   libobjc.A.dylib                     0x00007ff81ad90e25 objc_exception_throw + 48
    2   Foundation                          0x00007ff81c568eb7 -[NSMutableDictionary(NSMutableDictionary) initWithContentsOfFile:] + 0
    3   AppKit                              0x00007ff81ee4c0b9 -[NSCGLSurface flushRect:] + 2003
    4   AppKit                              0x00007ff81ee4b86e NSCGLSurfaceFlush + 164
    5   GLEngine                            0x00007ffa30a3dc12 glSwap_Exec + 210
    6   OpenGL                              0x00007ffa308079b3 CGLFlushDrawable + 59
    7   gameoverlayrenderer.dylib           0x0000000106710455 gameoverlayrenderer.dylib + 87125
    8   AppKit                              0x00007ff81e64ef9d -[NSOpenGLContext flushBuffer] + 20
    9   CityGameStudio                      0x00000001059df84e _ZN18VisualServerRaster4drawEv + 494"
  ],

While I see the steam overlay renderer crashing, I also see that the game seems to crash when the auto-save is triggered. Do you mind disabling the auto-saving feature please from the option in-game.

If it comes from it, I'm gonna have to rework the auto-save feature.

y2-Whyto commented 1 year ago

Hey @xsellier ,

Just now I followed your suggestion and disabled Auto-saving. It still crashed this time. And I don't have much to say, because this time it just went frozen itself and I was chatting on my phone. When I looked back at my mac screen, the game had already frozen, and I did nothing at that time. It was just at the general view of the game screen, some games being updated and some under development, nothing unusual.

The game crashed at ~22:52. Here are the log and the dump file:

Also, I just confirmed that Steam overlay had actually been disabled.

Hope this situation won't make debugging harder...

xsellier commented 1 year ago

Thank you for those logs. I'm gonna make a special version of the game, only for you, I think the issue comes from the multi-threading from within the game. I'll tell you the Steam branch as soon as it is ready

xsellier commented 1 year ago

Hey,

I've been working on improving the threads themselve. So on the unstable branch, with the steam overlay disabled, and no auto-save (disabled from the menu). Can you give it another try please,

It might crash, but it should be play for a long time.

y2-Whyto commented 1 year ago

Hello @xsellier ,

Today I played the game twice.

First of all I upgraded the game and disabled Steam overlay in the Steam Preference (it was merely disabled in game properties before). During the first game play it froze soon, and I was very shocked so I checked the game log and found the game version seemed to remain rc14, which was weird. So I just re-launched the game and confirmed that the game was already updated to rc15, and had a second game play. This time the game run much better, though finally it still crashed. But it lasted for ~2 hours.

During the second game play, the game crashed at a window for selecting a GOTY candidate.

For a more intuitive view, here are the settings of the two game plays respectively:

Settings 1st game play 2nd game play
Auto-save Disabled Disabled
Auto-adjust Enabled Disabled
Steam overlay
in Steam Preferences
Disabled Disabled
Steam overlay
in Game properties
Disabled Disabled

Here are the log and dump files of the two game plays:

xsellier commented 1 year ago

Hey,

I've been working on this crash lately, and I think it is now fixed. I removed all the remaining threads, so the game shouldn't crash anymore.

Still, the auto-save/steam overlay have to be disabled.

y2-Whyto commented 1 year ago

Hello @xsellier ,

This time I updated the game and had a nearly 3-hour game play with Anto-save and Steam overlay disabled. The game run smoothly without freezing. The bug seemed to be fixed.

xsellier commented 1 year ago

Neat I'm closing this then