I have an ArrayList
with a button on each row. When the button on the ArrayList
is clicked, a class that extends AsyncTask
is called to update my database. When execution reaches httpURLConnection.setDoOutput(true)
in this class, the app crashes while debugging and the below error message is given. If I run the app without the debugger, the app does not crash but it also does not appear to execute the .php
the file that is called in the class that extends AsyncTask
.
Among other things, this article
Android Fatal signal 11 (SIGSEGV) at 0x636f7d89 (code=1). How can it be tracked down?
suggest a common reason for SIGSEV is the Canvas drawing something that is null. This may be the problem I have since I have a null pointer dereference in the error message.
How do I troubleshoot and/or resolve the error message below? My relevant code follows the error message.
EDIT 190910
The error listed below may have something to do with calling notifyDataSetChanged() before the asyncTask finishes. I am going to edit my code to call notifyDataSetChanged() after the asyncTask finishes. I will report back once I have the result.
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="75dp"
xmlns:app="http://schemas.android.com/apk/res-auto">
<TextView
android:id="@+id/phoneTV"
android:layout_width="176dp"
android:layout_height="35dp"
android:layout_marginTop="18dp"
android:layout_marginLeft="18dp"
android:hint="(999) 999-9999"
android:textAppearance="@style/TextAppearance.AppCompat.Headline"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/delButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Delete"
android:layout_marginLeft="8dp"
android:layout_marginTop="11dp"
app:layout_constraintLeft_toRightOf="@+id/phoneTV"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
AdapterAcceptedNumber.java
public class AdapterAcceptedNumber extends ArrayAdapter<String> {
List<String> acceptedNums = new ArrayList();
Context context;
public AdapterAcceptedNumber(Context context,int resource){
super(context,resource);
this.context = context;
}
@Override
public int getCount() {
return acceptedNums.size();
}
@Nullable
@Override
public String getItem(int position) {
return acceptedNums.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@NonNull
@Override
public View getView(final int position, @Nullable View convertView, @NonNull ViewGroup parent) {
View row;
row = convertView;
AdapterAcceptedNumber.ViewHolder holder = null;
//row is null until user moves the list on the screen
if(row == null) {
LayoutInflater layoutInflater = (LayoutInflater)this.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
row = layoutInflater.inflate(R.layout.row_layout_text_button, parent, false);
holder = new AdapterAcceptedNumber.ViewHolder();
holder.acceptedNumTV = (TextView)row.findViewById(R.id.phoneTV);
holder.delButt = (Button)row.findViewById(R.id.delButton);
// holder.delButt.setOnClickListener((PhoneAcceptedActivity)this.getContext());
holder.delButt.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String CollectorPhoneNumberToDelete = getNumber(position);
SharedPreferences sharedPref = context.getSharedPreferences(context.getString(R.string.preferenceKeyFile),MODE_PRIVATE);
String gid = sharedPref.getString("groupID","error");
BackgroundWorker backgroundWorker = new BackgroundWorker(context);
backgroundWorker.execute("DeleteLogin",CollectorPhoneNumberToDelete,gid);
}
});
row.setTag(holder);
}else{
holder=(AdapterAcceptedNumber.ViewHolder)row.getTag();
}
String digits = acceptedNums.get(position);
holder.acceptedNumTV.setText(digits);
return row;
}
public void updateRecord(List<String> phoneNums){
acceptedNums = phoneNums;
notifyDataSetChanged();
}
public void delPhoneNumber(int positionToDelete){
acceptedNums.remove(positionToDelete);
notifyDataSetChanged();
}
public String getNumber(int position){
return acceptedNums.get(position);
}
private static class ViewHolder
{
TextView acceptedNumTV;
Button delButt;
}
}
public class BackgroundWorker extends AsyncTask<String, String, String> {
Context context;
BackgroundWorker(Context ctx){
context = ctx;
}
//https://www.youtube.com/watch?v=eldh8l8yPew
@Override
protected String doInBackground(String... params) {
String type = params[0];
String deleteLogin_url = "file.php";
}else if (type.equals("DeleteLogin")){
try {
String phoneNumberToDelete = "";
String gid = "";
if(!params[1].equals("null"))
phoneNumberToDelete = params[1];
if(!params[2].equals("null"))
gid = params[2];
URL urlAddress = new URL(deleteLogin_url);
HttpURLConnection httpURLConnection = (HttpURLConnection)urlAddress.openConnection();
httpURLConnection.setRequestMethod("POST");
httpURLConnection.setDoOutput(true); //crashes here when debugging
httpURLConnection.setDoInput(true);
OutputStream outputStreamAddress = httpURLConnection.getOutputStream();
BufferedWriter bufferedWriter = new BufferedWriter(new OutputStreamWriter(outputStreamAddress,"UTF-8"));
String postData = URLEncoder.encode("gid","UTF-8") + "=" + URLEncoder.encode(gid,"UTF-8") + "&"
+ URLEncoder.encode("collectorNumberToDelete","UTF-8") + "=" + URLEncoder.encode(phoneNumberToDelete,"UTF-8"); //post to php page
bufferedWriter.write(postData);
bufferedWriter.flush();
bufferedWriter.close();
outputStreamAddress.close();
InputStream inputStreamAddress = httpURLConnection.getInputStream();
//BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream, "iso-8859-1")); worked for local host
BufferedReader bufferedReaderAddress = new BufferedReader(new InputStreamReader(inputStreamAddress));
resultAddress = "";
String lineAddress = "";
while ( (lineAddress = bufferedReaderAddress.readLine()) != null){
resultAddress += lineAddress;
}
bufferedReaderAddress.close();
inputStreamAddress.close();
httpURLConnection.disconnect();
return "goBack";
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
Log:
>2019-09-08 20:34:51.792 8403-9265/com.rc.rentcollection W/zygote64: Got a deoptimization request on un-deoptimizable method java.net.InetAddress[] libcore.io.Linux.android_getaddrinfo(java.lang.String, android.system.StructAddrinfo, int)
>2019-09-08 20:34:51.994 8403-9265/com.rc.rentcollection W/zygote64: Got a deoptimization request on un-deoptimizable method java.lang.String com.rc.rentcollection.BackgroundWorker.doInBackground(java.lang.String[])
>2019-09-08 20:34:52.334 8403-9265/com.rc.rentcollection W/zygote64: Got a deoptimization request on un-deoptimizable method java.lang.String com.rc.rentcollection.BackgroundWorker.doInBackground(java.lang.String[])
>2019-09-08 20:34:54.448 8403-9265/com.rc.rentcollection A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0xc in tid 9265 (AsyncTask #6), pid 8403 (.rentcollection)
>2019-09-08 20:34:54.500 9277-9277/? E/propClient: PropClient failed to load
>2019-09-08 20:34:54.547 2832-2903/? E/QC-NETMGR-LIB: Unsupported attribute type, ignoring 0x8
>2019-09-08 20:34:54.547 2832-2903/? E/QC-NETMGR-LIB: unrecognized ifindex 20
>2019-09-08 20:34:54.548 2832-2903/? E/QC-NETMGR-LIB: Unsupported attribute type, ignoring 0x8
>2019-09-08 20:34:54.548 2832-2903/? E/QC-NETMGR-LIB: unrecognized ifindex 20
>2019-09-08 20:34:54.558 9278-9278/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
>2019-09-08 20:34:54.559 9278-9278/? A/DEBUG: Build fingerprint: 'Verizon/j7popltevzwpp/j7popltevzw:8.1.0/M1AJQ/J727VPPVRS3BSD1:user/release-keys'
>2019-09-08 20:34:54.559 9278-9278/? A/DEBUG: Revision: '5'
>2019-09-08 20:34:54.559 9278-9278/? A/DEBUG: ABI: 'arm64'
>2019-09-08 20:34:54.559 9278-9278/? A/DEBUG: pid: 8403, tid: 9265, name: AsyncTask #6 >>> com.rc.rentcollection <<<
>2019-09-08 20:34:54.559 9278-9278/? A/DEBUG: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0xc
>2019-09-08 20:34:54.559 9278-9278/? A/DEBUG: Cause: null pointer dereference
>2019-09-08 20:34:54.559 9278-9278/? A/DEBUG: x0 0000000000000000 x1 0000000000000001 x2 0000000000000008 x3 0000000000000003
>2019-09-08 20:34:54.559 9278-9278/? A/DEBUG: x4 0000006fd834190e x5 0000006fcf0185d8 x6 20646f6874656d20 x7 20646f6874656d20
>2019-09-08 20:34:54.559 9278-9278/? A/DEBUG: x8 0000006fbf502f20 x9 6891c97f3b1a61c6 x10 0000006fcf0185d0 x11 0000000000000010
>2019-09-08 20:34:54.559 9278-9278/? A/DEBUG: x12 0000006fcf0b49d0 x13 6c62617a696d6974 x14 0000000000000028 x15 0000006fbeded000
>2019-09-08 20:34:54.559 9278-9278/? A/DEBUG: x16 0000006fd83ce528 x17 000000705b6fc870 x18 0000006fbf5017cc x19 0000006fbf502f20
>2019-09-08 20:34:54.559 9278-9278/? A/DEBUG: x20 0000000000000000 x21 0000000000000001 x22 0000006fbf503588 x23 0000000000000000
>2019-09-08 20:34:54.559 9278-9278/? A/DEBUG: x24 0000006fbf502f20 x25 0000006fbf503588 x26 0000006fbeded0a0 x27 0000000000000001
>2019-09-08 20:34:54.559 9278-9278/? A/DEBUG: x28 0000000000000043 x29 0000006fbf502f10 x30 0000006fd8246768
>2019-09-08 20:34:54.559 9278-9278/? A/DEBUG: sp 0000006fbf502df0 pc 0000006fd7e8027c pstate 0000000060000000
>2019-09-08 20:34:54.582 9278-9278/? A/DEBUG: backtrace:
>2019-09-08 20:34:54.582 9278-9278/? A/DEBUG: #00 pc 00000000000dd27c /system/lib64/libart.so (art::ArtMethod::PrettyMethod(bool)+56)
>2019-09-08 20:34:54.582 9278-9278/? A/DEBUG: #01 pc 00000000004a3764 /system/lib64/libart.so (art::Thread::QuickDeliverException()+564)
>2019-09-08 20:34:54.582 9278-9278/? A/DEBUG: #02 pc 0000000000521d14 /system/lib64/libart.so (artDeliverPendingExceptionFromCode+8)
>2019-09-08 20:34:54.582 9278-9278/? A/DEBUG: #03 pc 00000000005507a8 /system/lib64/libart.so (art_quick_to_interpreter_bridge+248)
>2019-09-08 20:34:54.582 9278-9278/? A/DEBUG: #04 pc 0000000000547588 /system/lib64/libart.so (art_quick_invoke_stub+584)
>2019-09-08 20:34:54.582 9278-9278/? A/DEBUG: #05 pc 00000000000dd0b4 /system/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+200)
>2019-09-08 20:34:54.582 9278-9278/? A/DEBUG: #06 pc 000000000046bca4 /system/lib64/libart.so (art::InvokeWithArgArray(art::ScopedObjectAccessAlreadyRunnable const&, art::ArtMethod*, art::ArgArray*, art::JValue*, char const*)+104)
>2019-09-08 20:34:54.582 9278-9278/? A/DEBUG: #07 pc 000000000046ce34 /system/lib64/libart.so (art::InvokeVirtualOrInterfaceWithJValues(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jmethodID*, jvalue*)+772)
>2019-09-08 20:34:54.582 9278-9278/? A/DEBUG: #08 pc 0000000000493718 /system/lib64/libart.so (art::Thread::CreateCallback(void*)+1120)
>2019-09-08 20:34:54.582 9278-9278/? A/DEBUG: #09 pc 0000000000069974 /system/lib64/libc.so (__pthread_start(void*)+36)
>2019-09-08 20:34:54.583 9278-9278/? A/DEBUG: #10 pc 000000000001f864 /system/lib64/libc.so (__start_thread+68)
>2019-09-08 20:34:55.507 2685-2685/? E//system/bin/tombstoned: Tombstone written to: /data/tombstones/tombstone_01
>2019-09-08 20:34:55.512 3218-9279/? W/ActivityManager: crash : com.rc.rentcollection,0
>2019-09-08 20:34:55.515 3218-9279/? W/ActivityManager: Force finishing activity com.rc.rentcollection/.PhoneAcceptedActivity
>2019-09-08 20:34:55.519 2643-2643/? E/audit: type=1701 audit(1567992895.507:817): auid=4294967295 uid=10221 gid=10221 ses=4294967295 subj=u:r:untrusted_app:s0:c512,c768 pid=8403 comm=4173796E635461736B202336 exe="/system/bin/app_process64" sig=11
>2019-09-08 20:34:55.525 3218-3294/? W/Choreographer: Frame time is 12.38591 ms in the future! Check that graphics HAL is generating vsync timestamps using the correct timebase.
>2019-09-08 20:34:55.528 3218-3235/? W/zygote64: kill(-8376, 9) failed: No such process
>2019-09-08 20:34:55.544 3218-3235/? W/zygote64: kill(-8376, 9) failed: No such process
>2019-09-08 20:34:55.545 3218-3325/? W/InputDispatcher: channel ~ Consumer closed input channel or an error occurred. events=0x9
>2019-09-08 20:34:55.545 3218-3325/? E/InputDispatcher: channel ~ Channel is unrecoverably broken and will be disposed!
>2019-09-08 20:34:55.545 3218-3325/? W/InputDispatcher: channel ~ Consumer closed input channel or an error occurred. events=0x9
>2019-09-08 20:34:55.545 3218-3325/? E/InputDispatcher: channel ~ Channel is unrecoverably broken and will be disposed!
>2019-09-08 20:34:55.549 3218-3325/? W/InputDispatcher: channel ~ Consumer closed input channel or an error occurred. events=0x9
>2019-09-08 20:34:55.549 3218-3325/? E/InputDispatcher: channel ~ Channel is unrecoverably broken and will be disposed!
>2019-09-08 20:34:55.550 3218-3325/? W/InputDispatcher: channel ~ Consumer closed input channel or an error occurred. events=0x9
>2019-09-08 20:34:55.550 3218-3325/? E/InputDispatcher: channel ~ Channel is unrecoverably broken and will be disposed!
>2019-09-08 20:34:55.550 3218-3235/? W/zygote64: kill(-8403, 9) failed: No such process
>2019-09-08 20:34:55.553 3218-3995/? W/InputDispatcher: Attempted to unregister already unregistered input channel
>2019-09-08 20:34:55.557 3218-16036/? W/InputDispatcher: Attempted to unregister already unregistered input channel
>2019-09-08 20:34:55.579 8496-8496/? W/ContextImpl: Calling a method in the system process without a qualified user: android.app.ContextImpl.startService:1545 android.content.ContextWrapper.startService:669 android.content.ContextWrapper.startService:669 com.samsung.android.sm.common.SmartManagerReceiver.a:240 com.samsung.android.sm.common.SmartManagerReceiver.onReceive:119
>2019-09-08 20:34:55.580 3218-3707/? W/InputDispatcher: Attempted to unregister already unregistered input channel
>2019-09-08 20:34:55.583 3218-3969/? W/InputDispatcher: Attempted to unregister already unregistered input channel
>2019-09-08 20:34:55.599 501-629/? E/ANDR-PERF-MPCTL: Invalid profile no. 0, total profiles 0 only
>2019-09-08 20:34:55.618 9281-9281/? E/Zygote: isWhitelistProcess - Process is Whitelisted
>2019-09-08 20:34:55.618 9281-9281/? E/libpersona: scanKnoxPersonas
>2019-09-08 20:34:55.618 9281-9281/? E/libpersona: Couldn't open the File - /data/system/users/0/personalist.xml - No such file or directory
>2019-09-08 20:34:55.621 9281-9281/? W/SELinux: SELinux selinux_android_compute_policy_index : Policy Index[2], Con:u:r:zygote:s0 RAM:SEPF_SM-J727VPP_8.1.0_0008, [-1 -1 -1 -1 0 1]
>2019-09-08 20:34:55.627 3218-3235/? W/zygote64: kill(-8233, 9) failed: No such process
>2019-09-08 20:34:55.628 3218-3242/? W/ActivityManager: setHasOverlayUi called on unknown pid: 8403
>2019-09-08 20:34:55.632 3218-3235/? W/zygote64: kill(-8233, 9) failed: No such process
>2019-09-08 20:34:55.638 3218-3235/? W/zygote64: kill(-8233, 9) failed: No such process
>2019-09-08 20:34:55.643 3218-3235/? W/zygote64: kill(-8233, 9) failed: No such process
>2019-09-08 20:34:55.644 3218-9006/? W/BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.DROPBOX_ENTRY_ADDED flg=0x10 (has extras) } to com.google.android.gms/.stats.service.DropBoxEntryAddedReceiver
>2019-09-08 20:34:55.644 3218-3233/? W/BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.DROPBOX_ENTRY_ADDED flg=0x10 (has extras) } to com.google.android.gms/.chimera.GmsIntentOperationService$PersistentTrustedReceiver
>2019-09-08 20:34:55.644 3218-3234/? W/Looper: Dispatch took 119ms on android.ui, h=Handler (com.android.server.am.ActivityManagerService$UiHandler) {4215cc} cb=null msg=1
>2019-09-08 20:34:55.648 3218-3235/? W/zygote64: kill(-8233, 9) failed: No such process
>2019-09-08 20:34:55.707 8533-8612/? W/PkgUtils: p: com.rc.rentcollection, u:0
>2019-09-08 20:34:55.716 9302-9302/? E/propClient: PropClient failed to load
>2019-09-08 20:34:55.750 9305-9305/? E/propClient: PropClient failed to load
>2019-09-08 20:34:55.750 9304-9304/? E/propClient: PropClient failed to load
>2019-09-08 20:34:55.764 9307-9307/? E/propClient: PropClient failed to load
>2019-09-08 20:34:55.855 9281-9312/com.rc.rentcollection W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.
>2019-09-08 20:34:55.872 9281-9314/com.rc.rentcollection W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.
>2019-09-08 20:34:56.363 9307-9307/? E/propClient: PropClient failed to load
>2019-09-08 20:34:56.370 9307-9307/? W/ADebug: Failed to get property persist.sys.media.traces
>2019-09-08 20:34:56.390 9307-9307/? E/appproc: Enhanced Zygote ASLR: ro.knox.enhance.zygote.aslr != 1. Enhanced Zygote ASLR is DISABLED!
>2019-09-08 20:34:56.733 3218-3294/? W/Choreographer: Frame time is 13.006558 ms in the future! Check that graphics HAL is generating vsync timestamps using the correct timebase.
>2019-09-08 20:34:56.836 9307-9307/? E/SemAffinityControl: SemAffinityControl: registerfunction enter
>2019-09-08 20:34:56.896 3218-3242/? E/ANDR-PERF-JNI: com_qualcomm_qtiperformance_native_perf_io_prefetch_start
>2019-09-08 20:34:56.920 9307-9334/? W/MessageQueue: Handler (android.os.Handler) {384f244} sending message to a Handler on a dead thread
java.lang.IllegalStateException: Handler (android.os.Handler) {384f244} sending message to a Handler on a dead thread
at android.os.MessageQueue.enqueueMessage(MessageQueue.java:545)
at android.os.Handler.enqueueMessage(Handler.java:662)
at android.os.Handler.sendMessageAtTime(Handler.java:631)
at android.os.Handler.sendMessageDelayed(Handler.java:601)
at android.os.Handler.post(Handler.java:357)
at android.os.ResultReceiver$MyResultReceiver.send(ResultReceiver.java:57)
at com.android.internal.os.IResultReceiver$Stub.onTransact(IResultReceiver.java:58)
at android.os.Binder.execTransact(Binder.java:705)
>2019-09-08 20:34:56.957 9338-9338/? E/propClient: PropClient failed to load
>2019-09-08 20:34:57.063 3218-3294/? E/WindowManager: win=Window{df00e56 u0 Splash Screen com.rc.rentcollection EXITING} destroySurfaces: appStopped=false win.mWindowRemovalAllowed=true win.mRemoveOnExit=true win.mViewVisibility=0, caller=com.android.server.wm.AppWindowToken.destroySurfaces:748 com.android.server.wm.AppWindowToken.destroySurfaces:732 com.android.server.wm.WindowState.onExitAnimationDone:5523 com.android.server.wm.WindowStateAnimator.stepAnimationLocked:553 com.android.server.wm.DisplayContent.lambda$-com_android_server_wm_DisplayContent_21292:465
>2019-09-08 20:34:57.312 9338-9338/? E/propClient: PropClient failed to load
>2019-09-08 20:34:57.314 9338-9338/? W/ADebug: Failed to get property persist.sys.media.traces
>2019-09-08 20:34:57.320 9338-9338/? E/appproc: Enhanced Zygote ASLR: ro.knox.enhance.zygote.aslr != 1. Enhanced Zygote ASLR is DISABLED!
>2019-09-08 20:34:57.494 9338-9338/? E/SemAffinityControl: SemAffinityControl: registerfunction enter
>2019-09-08 20:34:57.512 9338-9347/? W/MessageQueue: Handler (android.os.Handler) {81641c0} sending message to a Handler on a dead thread
java.lang.IllegalStateException: Handler (android.os.Handler) {81641c0} sending message to a Handler on a dead thread
at android.os.MessageQueue.enqueueMessage(MessageQueue.java:545)
at android.os.Handler.enqueueMessage(Handler.java:662)
at android.os.Handler.sendMessageAtTime(Handler.java:631)
at android.os.Handler.sendMessageDelayed(Handler.java:601)
at android.os.Handler.post(Handler.java:357)
at android.os.ResultReceiver$MyResultReceiver.send(ResultReceiver.java:57)
at com.android.internal.os.IResultReceiver$Stub.onTransact(IResultReceiver.java:58)
at android.os.Binder.execTransact(Binder.java:705)