You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There was a bug that caused the process to hang.
To reproduce:
Follow step 2 to 5 in the Readme
2. python3
3. import ironSeed
4. game = ironSeed.IronSeed()
5. Now wait until the initialisation is finished
Now try and exit.... you cannot, you need to kill the process with kill -9
My OS: Linux (Debian Sid)
It was hard to debug as the program apparently ran to end, I tried adding a final print statement, and it was printed fine. So the process should exit. But it did not.
I early on suspected some background task of pygame to be the culprit.
I narrowed the cause it down to the pygame.init being called multiply times. This happens because there is a call to this pygame.init function in the root scope of global_constants.py, causing this function to be called each time this file is imported by any other file.
I also found that this error was not consistent, some times it would exit fine with no delay and other times just hang. I also found that if commented out some of the imports, that also imported global_constants, thereby reducing the number of times that pygame.init was called, I saw a drop in the number times it would hang, confirming my suspicion that this was triggering some race condition in the pygame background tasks.
Solution: I moved the initialization of the non-primitive types inside an init function, including this call to pygame,init(). So now the pygame.init() is only called when this function is explicitly called. Also added the call to this init() to ironSeed.py.
Note: I had to inject the h.IronSeedTime object through this call to, as calling it directly from within globals would not work as it would create a circular import loop.
The text was updated successfully, but these errors were encountered:
I'm addressing this in the intialization screen branch, where I'm writing a proper loading screen. Your suggestions provided me with some inspiration ;) It also reminded me I currently have time to look at this project again; it's been a horror year, I keep losing my holiday breaks to lockdowns and remote work.
There was a bug that caused the process to hang.
To reproduce:
Follow step 2 to 5 in the Readme
2. python3
3. import ironSeed
4. game = ironSeed.IronSeed()
5. Now wait until the initialisation is finished
Now try and exit.... you cannot, you need to kill the process with kill -9
My OS: Linux (Debian Sid)
It was hard to debug as the program apparently ran to end, I tried adding a final print statement, and it was printed fine. So the process should exit. But it did not.
I early on suspected some background task of pygame to be the culprit.
I narrowed the cause it down to the pygame.init being called multiply times. This happens because there is a call to this pygame.init function in the root scope of global_constants.py, causing this function to be called each time this file is imported by any other file.
I also found that this error was not consistent, some times it would exit fine with no delay and other times just hang. I also found that if commented out some of the imports, that also imported global_constants, thereby reducing the number of times that pygame.init was called, I saw a drop in the number times it would hang, confirming my suspicion that this was triggering some race condition in the pygame background tasks.
Solution: I moved the initialization of the non-primitive types inside an init function, including this call to pygame,init(). So now the pygame.init() is only called when this function is explicitly called. Also added the call to this init() to ironSeed.py.
Note: I had to inject the h.IronSeedTime object through this call to, as calling it directly from within globals would not work as it would create a circular import loop.
The text was updated successfully, but these errors were encountered: