How to investigate and fix libpjsua2.so error

SIGSEGV SEGV_MAPERR at 0x00000008 0 libpjsua2.so 0x56585a88 pj::Call::getInfo() const 1 libpjsua2.so 0x56546b44 std::allocator<pj::CallMediaInfo>::allocator() 

I use pjsip for one of my hobby projects (GPL compliant). Above you can see the stack received from crashtics. I am using Java shell for pjsip.

This error accounts for a lot of users (50%), however I cannot reproduce it on my local devices.

Not sure, but I suspect the next java call will result in an error. What C ++ call through JNI

 public void notifyCallState(MyCall call) { if (currentCall == null || call.getId() != currentCall.getId()) return; CallInfo ci; try { ci = call.getInfo(); } catch (Exception e) { ci = null; } Message m = Message.obtain(handler, MSG_TYPE.CALL_STATE, ci); m.sendToTarget(); if (ci != null && ci.getState() == pjsip_inv_state.PJSIP_INV_STATE_DISCONNECTED) { currentCall = null; } } 

The snapshots of the code are taken from examples that come from the psjua download. Link to http repo . My code is the same. Any help is much appreciated

+5
source share
2 answers

From stacktrace it looks like this: call is null, and the getId method has an offset of 0x8.

If this is true, correct this to make sure that notifyCallState not called with the null argument or to check it inside the method, notifyCallState .:

 if (call == null || currentCall == null || call.getId() != currentCall.getId()) return; 
+2
source

Your program will most likely end up in some kind of memory corruption and most likely in a bunch of memory. The following observations indicate this.

  • I cannot play it on my local devices. These are common symptoms of memory damage.
  • stack-trace includes a std :: allocator, which indicates that the program was interrupted while using (create / delete / access) heap memory.

Recommendation

  • We should try to look at the logic of the code and whether this program uses the Interop service correctly. I don't have a big idea on this, but it looks like your program logic has JAVA / C ++ interaction. If we are lucky, we can get something obvious here, and we are done.
  • If the stack trace after the effect is something else, then we are having problems that may have to take the approach suggested in the following posts.

Windows platform

fooobar.com/questions/972103 / ...

Linux platform

fooobar.com/questions/504437 / ...

Android platform

fooobar.com/questions/1224056 / ...

You may want to refer to the above posts to get an idea of ​​how to deal with such problems. In my opinion, the Android platform does not have dynamic tools, so you may need to use some versions (debugging / additional logging) of your library.

I hope the above information can be useful, and I would offer some recommendations to solve your problem.

0
source

All Articles