Native crash on awake

Hi, I`m getting crash on device wake and have NO idea how to dig the problem.

Very simple and reproducible: run the app, turn off, then turn it on

another crash screen (on 32 bit iPad)

What I found so far during wake:

We have a native crash right after “SSL socket timeout exception”.

com.turbomanage.httpclient.BasicHttpClient myClient = …;
try {
resp = myClient.get(path, null); // <- SSL socket timeout exception happens and native crash
} catch (final Throwable t) { <-- we never go here
System.out.println("net: h = " + this.hashCode() + “, throwable” + t);
…
}

We use “Executors.newFixedThreadPool(8)” for HTTP work thread pool.

We are trying to reduce the test.

Dear Kirill

SIGPIPE is not a severe signal as far as I know, but LLDB will catch it anyway.
There are multiple solutions:

  • Run your application without debugging. (You can either disable debugging for the scheme or start the application outside of Xcode.)
  • Tell LLDB to ignore the signal.

Daniel

I had the same issue with SSL connections. App from Testflight would crash after waking the physical device with only SIGPIPE error in device logs.

For me, only disabling HTTPS connection has worked. Is there any other way to fix it?

Hi Mateusz,

could you try the SIGPIPE masking trick that Daniel suggested as well?

Best Regards,
Gergely

Also: did the crash only happen when launching from Xcode, or when the device was not connected to your Mac as well? As Daniel said: SIGPIPE in itself is not necessarily a fatal error, but LLDB tends to catch it.

When Xcode is not attached we have a app crash on device wake.
In Xcode I see this trap, however I can continue it and app goes.

I can not continue it on a detached device.

Did you manage to test it with Daniel’s suggestion (to mask the SIGPIPE signal)?

Avoiding Common Networking Mistakes says to execute signal(SIGPIPE, SIG_IGN). I can find signal(int, @FunctionPtr(name = "call_signal") Function_signal) in Globals, but am unable to find both SIGPIPE and SIG_INT. Are they available, and if so, where can I find them?

I do not understand what can I do with the signals in a running app without debugger.
Our QA folks reporting network related crashed after waking app.

I did this, will see if it helps

// #include <sys/signal.h>
public static final int SIGPIPE = 13;
public static final long SIG_IGN = 1;

@CFunction
public static native @NUInt long signal(int sig, @NUInt long handler);

@Override
public boolean applicationDidFinishLaunchingWithOptions(UIApplication application, NSDictionary<?, ?> launchOptions) {
signal(MoeObjC.SIGPIPE, MoeObjC.SIG_IGN);
…
}

FYI putting this one line in applicationDidFinishLaunchingWithOptions fixed it for me:

Globals.sigignore(13);

1 Like

MOE is so Great!!! I was getting the same issue for weeks and I could not found useful doc online. My app was always crashing because of the "The connection was broken. It was probably closed by the client. Reason: sendto failed: EPIPE (Broken pipe)
"
But using Globals.sigignore(13); inside the applicationDidFinishLaunchingWithOptions method did solve my issue on both Java and Kotlin projects.

Thanks for the investigation :slight_smile:

and Bravo MOE and the Community for the great work