Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash on exit iOS application when using iOS 13 #7966

Closed
sanja-sa opened this issue Mar 6, 2017 · 28 comments · Fixed by #33154
Closed

Crash on exit iOS application when using iOS 13 #7966

sanja-sa opened this issue Mar 6, 2017 · 28 comments · Fixed by #33154

Comments

@sanja-sa
Copy link

sanja-sa commented Mar 6, 2017

iPhone 5( 32bit) - Godot version: 2.1.2

Crash on exit application in godot/servers/audio/audio_server_sw.cpp on line 774:

void AudioServerSW::_thread_func(void *self) {

	Thread::set_name("AudioServerSW");

	AudioServerSW *as=(AudioServerSW *)self;

	while (!as->exit_update_thread) {
		as->_update_streams(true);
		OS::get_singleton()->delay_usec(5000); <<--  Crash here
	}

}

Resume: OS::get_singleton() -- not thread save (maybe do "delay_usec" as static) and not correct finalize class.
In my case OS::get_singleton() === NULL.

@lukaskotik
Copy link

It seems to me that this can be the same issue as (see the last comment) #5426

@sanja-sa
Copy link
Author

It looks like the crash occurs in different places when exit the application. It looks like a memory leak somewhere. Only iOS version. It takes more time to search for a leak.

@kubecz3k
Copy link
Contributor

First of all thank you for your report and sorry for the delay.

We released Godot 3.0 in January 2018 after 18 months of work, fixing many old issues either directly, or by obsoleting/replacing the features they were referring to.

We still have hundreds of issues whose relevance/reproducibility needs to be checked against the current stable version, and that's where you can help us.
Could you check if the issue that you described initially is still relevant/reproducible in Godot 3.0 or any newer version, and comment about its current status here?

For bug reports, please also make sure that the issue contains detailed steps to reproduce the bug and, if possible, a zipped project that can be used to reproduce it right away. This greatly speeds up debugging and bugfixing tasks for our contributors.

Our Bugsquad will review this issue more in-depth in 15 days, and potentially close it if its relevance could not be confirmed.

Thanks in advance.

Note: This message is being copy-pasted to many "stale" issues (90+ days without activity). It might happen that it is not meaningful for this specific issue or appears oblivious of the issue's context, if so please comment to notify the Bugsquad about it.

@sanja-sa
Copy link
Author

I cannot test it in Godot 3.0 version, because in this case i must rewrite all project code for Godot 3.0, but it's cannot be done in this time point. Godot 3.0 is slower than 2.1.4 and I'm waiting 3.1 with Vulcan version. Android version (Adreno GPU) very slowely and crossplatform developing in this case breaked.

@kubecz3k
Copy link
Contributor

Oh ok I see. Will need to test in 3.1 in such case

@aaronfranke
Copy link
Member

aaronfranke commented Jul 9, 2018

Godot 3.1 will not have Vulkan support, you will have to wait for 4.0 for that.

You should update your project for Godot 3.x to confirm if the issue still exists. If Godot is slower for you then that's another issue that should be addressed. But if you are not willing to test it in the latest releases I'm not sure how much we can help you.

On a related note, do we want to keep supporting 32-bit iPhones? Apple killed off 32-bit iPhone apps this year with the release of iOS 11. Even if we drop support for 32-bit iPhone apps in master, 2.1 and 3.0 would still support it.

@Xancett
Copy link

Xancett commented Aug 13, 2019

I have this issue in 3.1.1. I've only recently gotten the error message after adding low processor mode. I can look into this further but it might stem from there.

@Xancett
Copy link

Xancett commented Aug 15, 2019

Did some tests and I discovered it was not due to the low processor mode but due to the ios13 beta. When not on a beta firmware for iOS I'm not having any crashes on exit.

@pixelcarrot
Copy link

I just upgraded to official iOS 13. It crashed when killing the app.

@Calinou Calinou changed the title Crash on exit iOS application Crash on exit iOS application when using iOS 13 Sep 19, 2019
@Xancett
Copy link

Xancett commented Sep 19, 2019

2.1.2 only or 3.1.1 as well?

@pixelcarrot
Copy link

Godot 3.1.1

Previously, I tested on my iPad (with iOS 13 beta). It crashed when killing the app but it works fine on my iPhone iOS 12. After upgrading my iPhone to official iOS 13, I receive the same crash. :)

Noticed that when I just open the app, at the home screen, killing it has no crash. But when I open the app then change to another screen. Then it crashed when I kill the app.

@Xancett
Copy link

Xancett commented Sep 20, 2019

According to the verge (https://www.theverge.com/2019/9/19/20874293/apple-ios-13-1-ipados-september-24th-early-release-date-update-bug-fixes-features) ios 13.1 will be out on the 24th. This bug doesn't exist on the 13.1 beta that I'm currently in but did in a previous 13 beta. Maybe the issue will be patched in 13.1?

"More importantly, Apple promises that 13.1 will bring general bug fixes to iOS 13, which the current software could definitely benefit from. (Our review of the current 13.0 software notes a litany of issues we encountered while testing the new update.)"

@johngirvin
Copy link

Godot 3.1.1

Confirmed crashes on iOS 13.0 simulator and 13.1 iPhone XR when switching the game to the background (press device Home button). GLES2/GLES3 driver same. Crash logs attached.

Cannot reproduce on previous iOS versions.

gles2.txt
gles3.txt

@pixelcarrot
Copy link

Follow #32194 remove [self drawView] in layoutSubviews and re-compile can fix crashes when switching to the background (press Home button), but it still crashes when closing in the app switcher.

@ealataur
Copy link
Contributor

Hi all. I removed duplicated drawView and moving this part of code
from

- (void)drawView {
	if (useCADisplayLink) {
		// Pause the CADisplayLink to avoid recursion
		[displayLink setPaused:YES];

		// Process all input events
		while (CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.01, TRUE) == kCFRunLoopRunHandledSource)
			;

		// We are good to go, resume the CADisplayLink
		[displayLink setPaused:NO];
	}

	if (!active) {
		printf("draw view not active!\n");
		return;
	};

to

- (void)drawView {

	if (!active) {
		printf("draw view not active!\n");
		return;
	};

	if (useCADisplayLink) {
		// Pause the CADisplayLink to avoid recursion
		[displayLink setPaused:YES];

		// Process all input events
		while (CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.01, TRUE) == kCFRunLoopRunHandledSource)
			;

		// We are good to go, resume the CADisplayLink
		[displayLink setPaused:NO];
	}

And crashes is gone. Tested many time and not catched yet.

@volzhs
Copy link
Contributor

volzhs commented Oct 18, 2019

@ealataur would you make a PR? 😄

@gerald1248
Copy link

gerald1248 commented Oct 28, 2019

@ealataur could you post your diff? It's @justinngdev's patch plus the change you describe here?

Not fixed in the published 3.2 alpha 3 export template.

@ealataur
Copy link
Contributor

ealataur commented Oct 28, 2019

@gerald1248
This patch for 3.1.1 stable [66baa3b]
But I think it usable for master too..

patch.diff.zip

@gerald1248
Copy link

@ealataur awesome, thanks!

@akien-mga akien-mga added this to the 3.2 milestone Oct 28, 2019
@gerald1248
Copy link

gerald1248 commented Oct 29, 2019

@ealataur can confirm your patch fixes the issue. Uploading to App Store Connect now. Thanks again! (BTW I could swear I see dropped frames where previously I didn't. Am I missing optimisation flags I should pass to scons when compiling? I simply used scons p=iphone tools=no target=release arch=amd64 and the matching 32-bit variant before creating the universal library.)

@akien-mga
Copy link
Member

A pull request would be welcome so that we can review and hopefully merge the fix.

@ealataur
Copy link
Contributor

I created a pull request
#33154

@gerald1248
Copy link

@ealataur I have rebuilt using optimize=speed but I still observe a serious performance degradation. Happy to believe that I'm not building for iOS correctly, but do you think it's worth checking if the modified CFRunLoopRunInMode call has an impact on frame rate?

@ealataur
Copy link
Contributor

@gerald1248
please try change back this
while (CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.01, TRUE) == kCFRunLoopRunHandledSource)
to this
while (CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.0, TRUE) == kCFRunLoopRunHandledSource)

@gerald1248
Copy link

gerald1248 commented Oct 31, 2019 via email

@ealataur
Copy link
Contributor

@gerald1248
Ok. I will make a commit and pull request

akien-mga pushed a commit to ealataur/godot that referenced this issue Nov 5, 2019
akien-mga pushed a commit to akien-mga/godot that referenced this issue Nov 8, 2019
akien-mga pushed a commit that referenced this issue Nov 8, 2019
Fixes #7966.

(cherry picked from commit 29bde8c)
@jeudy-ua
Copy link

@gerald1248
Ok. I will make a commit and pull request

I have this problem with my game. Is this fix on version 3.2 stable? or do I have to recompile from the latest master? (I actually tried, but the export templates I got gave me errors when exporting).

@ealataur can you please share which export templates you used after you recompiled godot with the fix?

@gerald1248
Copy link

gerald1248 commented Dec 30, 2019 via email

akien-mga pushed a commit that referenced this issue May 28, 2020
Fixes #7966.

(cherry picked from commit 29bde8c)
halotroop2288 pushed a commit to Homebrodot/Godot that referenced this issue Jan 12, 2024
bherdm pushed a commit to bherdm/godot-for-ouya that referenced this issue Jul 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.