I am developing an app with the HERE SDK, and everything worked fine until now. I get errors like this one:Fatal signal 11 (SIGSEGV), code 1, fault addr 0x750057 in tid 10206 (FinalizerDaemon)
or this one:Fatal signal 11 (SIGSEGV), code 1, fault addr 0x94789680 in tid 24605 (FinalizerDaemon)
and they make my app crash.
It's not always the same errors, but they always come all alone in my Logcat,with no other information.
In all my app I am using HERE objects and services, and even by printing the stacktrace I don't get more information about the errors.
I just noticed that these errors appear pretty much randomly, but only when I am using these objects/services.
I use a real device to test my app, a Sony Xperia Z3 compact, so I don't think it comes from here.
I am really lost, so if someone has any idea even on how to get more infos about the errors, please help
EDIT:
05-09 23:04:10.148 6770-6782/? A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x4 in tid 6782 (FinalizerDaemon)
05-09 23:04:10.266 30179-30179/? I/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
05-09 23:04:10.266 30179-30179/? I/DEBUG: UUID: 5569a1b9-c913-4101-99fa-5099e2cadd48
05-09 23:04:10.266 30179-30179/? I/DEBUG: Build fingerprint: 'Sony/D5803/D5803:5.1.1/23.4.A.1.264/2418263178:user/release-keys'
05-09 23:04:10.266 30179-30179/? I/DEBUG: Revision: '0'
05-09 23:04:10.266 30179-30179/? I/DEBUG: ABI: 'arm'
05-09 23:04:10.266 30179-30179/? I/DEBUG: pid: 6770, tid: 6782, name: FinalizerDaemon >>> com.david.metroz <<<
05-09 23:04:10.266 30179-30179/? I/DEBUG: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x4
05-09 23:04:10.294 30179-30179/? I/DEBUG: r0 98327400 r1 00000000 r2 00000002 r3 00000000
05-09 23:04:10.294 30179-30179/? I/DEBUG: r4 aec264c0 r5 b3df7acc r6 98327400 r7 73652348
05-09 23:04:10.294 30179-30179/? I/DEBUG: r8 6f9983a8 r9 b482a800 sl 12f1d820 fp b3df7abc
05-09 23:04:10.294 30179-30179/? I/DEBUG: ip b5303950 sp b3df7ab0 lr b510717f pc a0b7205c cpsr a00e0010
05-09 23:04:10.294 30179-30179/? I/DEBUG: #00 pc 000f405c /data/app/com.david.metroz-1/lib/arm/libMAPSJNI.so (Java_com_nokia_maps_GeoBoundingBoxImpl_destroyNative+76)
05-09 23:04:10.294 30179-30179/? I/DEBUG: #01 pc 001d7d4f /data/dalvik-cache/arm/data@app@com.david.metroz-1@base.apk@classes.dex
05-09 23:04:12.302 862-1274/? E/NativeCrashListener: Exception dealing with report
android.system.ErrnoException: read failed: EAGAIN (Try again)
at libcore.io.Posix.readBytes(Native Method)
at libcore.io.Posix.read(Posix.java:165)
at libcore.io.BlockGuardOs.read(BlockGuardOs.java:230)
at android.system.Os.read(Os.java:350)
at com.android.server.am.NativeCrashListener.consumeNativeCrashData(NativeCrashListener.java:240)
at com.android.server.am.NativeCrashListener.run(NativeCrashListener.java:138)
EDIT 2: I am now pretty sure that the crash happens when I am retrieving HERE objects from database using gson.
The following code works when everything is done in the same app runtime, but when I save a string in the database, close the app and then re-open it, I get the Fatal signal
while converting the json string
back to the object.
// to insert I create a json string and then insert it in the database
String mGbSortie = gson.toJson(geoboundinBox);
//and then to retrieve the data :
Type gbType = new TypeToken<GeoBoundingBox>(){}.getType();
geoBoudingBox = gson.fromJson(stringFromDb, listType)
I really don't know why it doesn't work.
1) Firstly determine whether it's a bug within the android, the third party libraries or your device, so you can know which way to proceed.
This answer gives a solution of how to do this:
If you have written (or are using) a plugin that in turn uses native C/C++ code through the NDK, this may indicate a bug in that native code.
Otherwise, this is a bug in the firmware of the device or emulator you are testing upon.
If you can reproduce this in an emulator, on a Nexus device with the original ROM, or on a variety of devices from different manufacturers, it is probably a bug in Android itself. In that case, please create a sample project that can reproduce the error, and post it along with the entire stack trace to http://b.android.com, the Android OS issue tracker.
If you are only encountering this on one device or one third-party ROM, it is probably a more specific bug -- your best bet is to contact the device manufacturer or ROM publisher with your symptoms.
There are these two questions which discuss the error you are receiving in detail:
Android Fatal signal 11 (SIGSEGV) at 0x636f7d89 (code=1). How can it be tracked down?
Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1) - PhoneGap
2) In terms of parsing your geobounds values (as it would seem is where the problem may lie), ensure you are handling your parsing between Gson and Json correctly, with the correct geobound values. It appears how you are storing the values is not in accord with how you are retreiving them.
toJson() – Convert Java object to JSON
Gson gson = new Gson(); Staff obj = new Staff(); // 1. Java object to JSON, and save into a file gson.toJson(obj, new FileWriter("D:\\file.json")); // 2. Java object to JSON, and assign to a String String jsonInString = gson.toJson(obj);
fromJson() – Convert JSON to Java object
Gson gson = new Gson(); // 1. JSON to Java object, read it from a file. Staff staff = gson.fromJson(new FileReader("D:\\file.json"), Staff.class); // 2. JSON to Java object, read it from a Json String. String jsonInString = "{'name' : 'mkyong'}"; Staff staff = gson.fromJson(jsonInString, Staff.class); // JSON to JsonElement, convert to String later. JsonElement json = gson.fromJson(new FileReader("D:\\file.json"), JsonElement.class); String result = gson.toJson(json);
From this answer:
public class YourObject { private String appname; private String Version; private String UUID; private String WWXY; private String ABCD; private String YUDE; //getters/setters YourObject parsed = new Gson().fromJson(jsons, YourObject.class); String jsons = "{'appname':'application', 'Version':'0.1.0', 'UUID':'300V', 'WWXY':'310W', 'ABCD':'270B', 'YUDE':'280T'}"; YourObject parsed = new Gson().fromJson(jsons, YourObject.class); JsonObject object = new JsonParser().parse(jsons).getAsJsonObject(); object.get("appname"); // application object.get("Version"); // 0.1.0
These SO questions give more details:
How to parse json parsing Using GSON in android
parse JSON with gson and GsonBuilder()
3) Ensure you are passing the correct values for your geobound co-ords. This question Value does not fall within the expected range GeoboundingBox WinRT (although it is C# gives a good example of how to break down the components of information you are trying to store and retrieve.
The answer is straightforward.
var nw = new BasicGeoposition(); nw.Latitude = Max(pos.Coordinate.Latitude, pos2.lat); nw.Longitude = Min(pos.Coordinate.Longitude, pos2.lng); var se = new BasicGeoposition(); se.Latitude = Min(pos.Coordinate.Latitude, pos2.lat); se.Longitude = Max(pos.Coordinate.Longitude, pos2.lng);
And learn how to parse your json with gson:
Use Gson to work with JSON in your Android apps
There is also this gihub repo for you to browse for more ideas.
Can you paste any more info from adb logcat? It is currently not enough information for us to help you out. A segfault in the finalizer daemon can imply double deletion of native objects. Without more information, it could be anywhere in the OS or in the SDK.
The skipped frames means your app is processing lots of data in the main thread. Skipping 161 frames means over 3s of busy time! Please try to use AsyncTasks or threads to optimize your app.
It seems you are using GSON type deserializer, which will not construct our native objects correctly. Manually deserializing the lat, lng and calling new GeoBoundingBox() will not crash.
I have resolved same issue by following code.
Add android:vmSafeMode="true"
in application tag in Manifest file.
Your application tag should looks like:
<application
android:name=".MyApplication"
android:hardwareAccelerated="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:largeHeap="true"
android:theme="@style/AppTheme"
android:vmSafeMode="true">
// Other stuff
</application>
Hope this will help you.
来源:https://stackoverflow.com/questions/37101603/app-crashes-sometimes-with-fatal-signal-11-sigsegv-code-1