CouchDB Replication / Timeout Error - android

I'm running CouchDB with Yocto Dizzy on a LogicPD Torpedo with a 1GHz processor. I have multiple Android devices connected, making changes, and syncing with this database through some Java and Nodejs code. For the most part, it looks like the database is replicating properly across all devices.
However, I do have a frequent issue where a device will fall out of sync and the Android app on that device will have to be restarted. By "fall out of sync" I mean that changes are being made on one device, synced to the database, and not showing up on another device. I'm trying to troubleshoot this problem and I haven't been able to find any errors on the Android side. The errors I'm seeing in the CouchDB log are:
[Fri, 25 Sep 2015 14:47:59 GMT] [error] [<0.222.0>] ** Generic server <0.222.0> terminating
** Last message in was {'EXIT',<0.217.0>,killed}
** When Server state == {state,"http://X.XXX.X.X:XXXX/task/",20,[],
[<0.338.0>],
{[],[]}}
** Reason for termination ==
** killed
[Fri, 25 Sep 2015 14:47:59 GMT] [error] [<0.222.0>] {error_report,<0.31.0>,
{<0.222.0>,crash_report,
[[{initial_call,
{couch_replicator_httpc_pool,init,['Argument__1']}},
{pid,<0.222.0>},
{registered_name,[]},
{error_info,
{exit,killed,
[{gen_server,terminate,7,
[{file,"gen_server.erl"},{line,804}]},
{proc_lib,init_p_do_apply,3,
[{file,"proc_lib.erl"},{line,237}]}]}},
{ancestors,
[<0.217.0>,couch_replicator_job_sup,
couch_primary_services,couch_server_sup,<0.32.0>]},
{messages,[]},
{links,[<0.338.0>]},
{dictionary,[]},
{trap_exit,true},
{status,running},
{heap_size,610},
{stack_size,27},
{reductions,390}],
[]]}}
[Fri, 25 Sep 2015 14:48:06 GMT] [error] [<0.130.0>] Error in replication `b16486bad369b219600dbd5bf0478e81+continuous+create_target` (triggered by document `9be140c9aa6334820aed80fa910275e4`): timeout
Restarting replication in 5 seconds.
[Fri, 25 Sep 2015 14:48:06 GMT] [error] [<0.88.0>] {error_report,<0.31.0>,
{<0.88.0>,supervisor_report,
[{supervisor,{local,couch_replicator_job_sup}},
{errorContext,shutdown_error},
{reason,killed},
{offender,
[{pid,<0.157.0>},
{name,
"98e4832e6f31a0962493d26092b5fe4e+continuous+create_target"},
{mfargs,{gen_server,start_link,undefined}},
{restart_type,temporary},
{shutdown,250},
{child_type,worker}]}]}}
When running the same programs and database on CentOS with an i7, it all works perfectly. I've tried mucking with tcp/ip kernel settings, as well as CouchDBs settings (local.ini, specifically os_process and timeout options).
Does anyone have any experience in this area? Any help would be greatly appreciated!

Related

Samsung SM A550W HTTPS ExtCertPathValidatorException with wrong date

My app runs on all devices and simulators Except Samsung SM-A500W. It just failed to update the database. The access to the database is through php scripts stored in a TLD secure domain (Access only through httpS).
The failure is because it thinks the expiration date of the certificate is passed....not true. See LogCat.
10-25 11:07:18.381 25547-25617/uro2.tradersmicro.com.uro2 D/Uploadi16: Exception jb: com.android.org.bouncycastle.jce.exception.ExtCertPathValidatorException: Could not validate certificate: Certificate expired at Sat Feb 18 18:59:59 EST 2017 (compared to Thu Oct 25 11:07:18 EDT 2018) javax.net.ssl.SSLHandshakeException: com.android.org.bouncycastle.jce.exception.ExtCertPathValidatorException: Could not validate certificate: Certificate expired at Sat Feb 18 18:59:59 EST 2017 (compared to Thu Oct 25 11:07:18 EDT 2018)
BTW. One of the fragments of my app uses a WebView. The secure database access in this part is normal.
Is there a way to avoid this error?
The way I found to circumvent this problem is to copy the php scripts to a Non Secure Domain, and ensure that they get updated as the scripts are updated.
At run time:- in the try...catch of the database access to change the domain to the insecure one. So far works like a charm.
Of course the database access occurs in an Async task, it seems ok to call the method again, recursively from the catch code.
I would suggest trying to update the device security provider using the Google Play Service:
https://developer.android.com/training/articles/security-gms-provider
import com.google.android.gms.security.ProviderInstaller;
// ....
try {
ProviderInstaller.installIfNeeded(getContext());
} catch (GooglePlayServicesRepairableException e) {
// TODO handle error
}

Unable to compile Android app - Error 256 in Corona

I am using Corona SDK and I am trying to compile my app for Android. I have been able to compile for iOS.
When compiling using either a fully signed distribution key or a debug key I am given the following error:
Build Failed: Error code: 256
The full error is as follows:
Sep 23 01:24:00.635 Building Android app for mgr****#**.com with 2017.3135
Sep 23 01:24:02.541 BUILD SUCCESSFUL
Total time: 0 seconds
Sep 23 01:24:02.542
Sep 23 01:25:24.905 BuildID: 59c5a9a30bb42
Sep 23 01:25:34.119 [exec] Result: 1
Sep 23 01:25:36.428 BUILD FAILED
/Applications/Corona/Corona Simulator.app/Contents/Resources/build.xml:479: The following error occurred while executing this line:
/Applications/Corona/Corona Simulator.app/Contents/Resources/build.xml:454: jarsigner returned: 1
Total time: 6 seconds
Sep 23 01:25:36.539 Android build failed (256) after 95 seconds
Sep 23 01:25:36.816 ERROR: Build Failed: Error code: 256
I have tried Google Play and Amazon targets with the same outcome.
Any ideas massively appreciated.
I was able to compile the exact same files on a different machine (Windows) without an issue. I guess this is down to the Java installation on the other machine.
Interestingly, Corona required the 32-bit version of Java on Windows, which meant downloading a slightly older SDK/JDK (latest SDK only has 64-bit builds). My Mac has the latest 64-bit build, which Corona does not complain about, but isn't able to build with.

Very simple WebView crashes under API 23 Emulator

I have just created an API 23 emulator on my machine:
HAXM: v1.4 with 1GB allocated RAM
AVD Base: Nexus 4
RAM: 768MB, and 896MB in a second try
Heap: 64 MB
GPU acceleration: no
I tried it successfully with a few apps of my own. But each time I try an application that uses a WebView as a UI, the app crashes that way:
The three first line of this logcat are the only pertaining to my app (highlighted in blue). All other lines do not mention my application package's name in the 'Application' column of LogCat, but one does in the middle of the message (circled in blue).
I can load the HTML code into the WebView. The crash occurs at setContentView(theWebView) time:
public class MyActivity extends Activity {
private WebView mWebview = null;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mWebview = new WebView(this);
mWebview.loadDataWithBaseURL("file:///android_asset/", HTML_CODE, "text/html", "UTF-8", null);
setContentView(mWebview); // THIS IS WHERE THE CRASH OCCURS
}
[...]
Using or not using runOnUiThread() to run mWebview.loadDataWithBaseURL() produces exactly the same result, which is expected as onCreate() is actually on the UI thread.
The html code I am using does not change anything. In the case above, the HTML_CODE variable contains this:
<html>
<head></head>
<body>
<h1>Hello</h1>
<p>Hello world!</p>
</body>
</html>
The app runs perfectly, even with a more advanced HTML+CSS+JS+JS<->Java binding code on all the API 17 and 19 devices and emulators I tried. This is where I'm puzzled. I didn't have a chance to try with an actual Android 6.0 (API 23) device though.
EDIT
I have just :
migrated from Eclipse to Android Studio
upgraded HAXM to v1.5
upgraded my SDK Tools (24.4.1) and my platform (23.0.1)
The problem still occurs but the log is different, and a bit clearer. There is a ClassNotFoundException I cannot explain:
10-28 20:26:05.102 2168-2168/com.example.myapp W/System: ClassLoader referenced unknown path: /data/app/com.example.myapp-1/lib/x86
10-28 20:26:08.583 2168-2168/com.example.myapp E/DataReductionProxySettingListener: No DRP key due to exception:java.lang.ClassNotFoundException: com.android.webview.chromium.Drp
10-28 20:26:09.393 2168-2213/com.example.myapp W/chromium: [WARNING:data_reduction_proxy_config.cc(423)] SPDY proxy OFF at startup
10-28 20:26:12.521 2168-2286/com.example.myapp A/chromium: [FATAL:gl_surface_android.cc(58)] Check failed: kGLImplementationNone != GetGLImplementation() (0 vs. 0)
10-28 20:26:12.521 2168-2286/com.example.myapp A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 2286 (GpuThread)
Any idea? (I'm investigating further so I will update this post should I find anything relevant)
This behaviour was not caused by any erroneous setting of the AVD or any missing prerequisite (harware, etc...).
As cryptojuice mentioned in comments this was caused by an OpenGL ES prerequisite issue on emulator side:
#8 ...#chromium.org
Unfortunately OpenGL ES 2.0 support has been mandatory for devices
since at least Android 4.0, so we haven't ever explicitly supported
GLES 1.x at all and it was only working before by accident :/
It seems a bit problematic that the emulator (without host GPU
emulation) doesn't meet the minimum requirements for Android devices.
We might be able to work around this for the emulator at a significant
performance cost; we're talking to the emulator team about what the
best thing to do here is.
Now this is fixed (SDK tools 25.1 RC1 / platform 23 rev 3), even though this doesn't appear on the ticket linked above.

Reading MS Excel 2010 files in android using Apache POI

I am using Apache POI in my android application to read xlsx file stored in SDCARD.
I am using following jar libs from Apache POI
poi-ooxml-schemas-3.9-20121203.jar
poi-ooxml-3.9-20121203.jar
But when I try to Run Android App I am getting below mentioned stacktrace.
trouble writing output: Too many methods: 66024; max is 65536. By package:
13 java.lang
1 java.lang.reflect
5 java.util
1 javax.xml.namespace
66 org.apache.xmlbeans
19 org.apache.xmlbeans.impl.values
1 org.apache.xmlbeans.impl.xb.xmlschema
2500 org.openxmlformats.schemas.drawingml.x2006.chart
1430 org.openxmlformats.schemas.drawingml.x2006.chart.impl
8767 org.openxmlformats.schemas.drawingml.x2006.main
5258 org.openxmlformats.schemas.drawingml.x2006.main.impl
86 org.openxmlformats.schemas.drawingml.x2006.picture
33 org.openxmlformats.schemas.drawingml.x2006.picture.impl
745 org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing
417 org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.impl
230 org.openxmlformats.schemas.drawingml.x2006.wordprocessingDrawing
164 org.openxmlformats.schemas.drawingml.x2006.wordprocessingDrawing.impl
298 org.openxmlformats.schemas.officeDocument.x2006.customProperties
256 org.openxmlformats.schemas.officeDocument.x2006.customProperties.impl
617 org.openxmlformats.schemas.officeDocument.x2006.docPropsVTypes
596 org.openxmlformats.schemas.officeDocument.x2006.docPropsVTypes.impl
285 org.openxmlformats.schemas.officeDocument.x2006.extendedProperties
196 org.openxmlformats.schemas.officeDocument.x2006.extendedProperties.impl
23 org.openxmlformats.schemas.officeDocument.x2006.math
24 org.openxmlformats.schemas.officeDocument.x2006.relationships
2 org.openxmlformats.schemas.officeDocument.x2006.relationships.impl
2076 org.openxmlformats.schemas.presentationml.x2006.main
1224 org.openxmlformats.schemas.presentationml.x2006.main.impl
1 org.openxmlformats.schemas.schemaLibrary.x2006.main
7271 org.openxmlformats.schemas.spreadsheetml.x2006.main
4556 org.openxmlformats.schemas.spreadsheetml.x2006.main.impl
11448 org.openxmlformats.schemas.wordprocessingml.x2006.main
9217 org.openxmlformats.schemas.wordprocessingml.x2006.main.impl
4 schemaorg_apache_xmlbeans.system.sE130CAA0A01A7CDE5A2B4FEB8B311707
1170 schemasMicrosoftComOfficeExcel
1223 schemasMicrosoftComOfficeExcel.impl
285 schemasMicrosoftComOfficeOffice
124 schemasMicrosoftComOfficeOffice.impl
2 schemasMicrosoftComOfficePowerpoint
3 schemasMicrosoftComOfficeWord
2858 schemasMicrosoftComVml
2529 schemasMicrosoftComVml.impl
[2013-11-25 21:20:32 - CRD] Conversion to Dalvik format failed with error 2
Can anyone tell where am I missing?
If you use too much code for any android app, the compilation will throw this error. The similar problem is stated and resolved here. You should split the app in parts as a plugin, in the form of a separate APK available for download. That APK would expose some component that the main app would use. There are various app on google play of such kind.
Please note that there are a number of problems when using Apache POI on Android. The one you are hitting can be solved by the so called "multiDex" feature in newer versions of Android.
There are currently two projects which try to solve most of the problems for you:
https://github.com/andruhon/android5xlsx
https://github.com/centic9/poi-on-android/ (mainted by me)
The first one is currently based on POI 3.12, whereas the second can be re-compiled with newer versions of POI more easily.

Python System Call Cannot Find File, Error Running on Apache Server

I'm trying to run an os.system() call from my Python class to source a file I have stored in the file. I am connecting to a server from an Android application and running a method in Django to run a system call. The server is running Apache with mod_wsgi to deploy Django. This is the Django method:
def post_try(request):
os.chdir("/usr/local/src")
response = os.system("source sourceme")
return HttpResponse(response)
The code works fine as far as syntax goes, all necessary imports are done, however I keep getting a 256 error code back instead of the expected 0. I check the error in the Apache log and this is what I get:
[Sun Aug 18 19:43:23 2013] [notice] caught SIGTERM, shutting down
[Sun Aug 18 19:43:24 2013] [warn] mod_wsgi: Compiled for Python/2.7.2+.
[Sun Aug 18 19:43:24 2013] [warn] mod_wsgi: Runtime using Python/2.7.3.
[Sun Aug 18 19:43:24 2013] [notice] Apache/2.2.22 (Ubuntu) mod_wsgi/3.3 Python/2.7.3 configured -- resuming normal operations
[Sun Aug 18 19:46:04 2013] [notice] caught SIGTERM, shutting down
[Sun Aug 18 19:46:05 2013] [warn] mod_wsgi: Compiled for Python/2.7.2+.
[Sun Aug 18 19:46:05 2013] [warn] mod_wsgi: Runtime using Python/2.7.3.
[Sun Aug 18 19:46:05 2013] [notice] Apache/2.2.22 (Ubuntu) mod_wsgi/3.3 Python/2.7.3 configured -- resuming normal operations
sh: line 0: source: sourceme: file not found
I cannot figure out what is going on. I have the sourceme file clearly in the /usr/locals/src/ folder, which I have verified many times using ls. I do not know what is happening. I used os.getcwd() to check that the directory is being changed correctly, but the file still cannot be found. Please let me know if there is anything that I am missing, as I am very frustrated at this problem that I can just not realize.
Thank you
Your approach currently does not make sense:
os.system creates a child process of the WSGI process, while the environment of the parent is passed on to the child, the environment of the child is not passed back/shared with the parent.
Also, source is not a binary, but a built-in function of the shell itself.
If you want to set environment variables us os.environ which is a dictionary of the variables.
Since you are using python, it would be much more sensible to use python program instead of some os.system calls. That is, create python program with the environment variables, add it to your PYTHONPATH and import it in your django code.

Categories

Resources