dabs
Full Member
Posts: 78
|
Post by dabs on Jun 19, 2019 12:57:54 GMT
Hi,
we are using AsyncHttp to post data from our Rhomobile app to our backend, this backend will then connect to the backend of our client. We are running into a behaviour we are not sure who is responsible for, i.e. if the operation takes a very long time to complete (such as if the client backend doesn't respond until very late), then the system will retry the operation, and will do so up to 5 times. This may be behaviour built into the libraries we're using in our own backend, but I wanted to check if the AsyncHttp class has some retry logic?
Regards, Daníel
|
|
|
Post by Vladimir Musulainen on Jun 19, 2019 14:11:53 GMT
|
|
|
Post by Alex Epifanov on Jun 19, 2019 17:20:09 GMT
AsyncHttp API was deprecated long ago. Use the Rho::Network instead.
|
|
dabs
Full Member
Posts: 78
|
Post by dabs on Jun 19, 2019 22:54:34 GMT
Ok, I'll look into replacing our usage of AsyncHttp with Network. In the meantime, is it possible that AsyncHttp is responsible for those retries?
|
|
dabs
Full Member
Posts: 78
|
Post by dabs on Jun 19, 2019 23:46:47 GMT
Ah it seems that the callback_params available in AsyncHttp are no longer available in the Network.get() method. Which makes switching non-trivial as we rely heavily on the callback parameters.
|
|
|
Post by Alex Epifanov on Jun 20, 2019 0:28:46 GMT
|
|
|
Post by Alex Epifanov on Jun 20, 2019 0:32:19 GMT
dabs Daniel what is the Rhodes version you are currently using? There were some changes in CURL logic for recent builds.
|
|
|
Post by Alex Epifanov on Jun 20, 2019 0:37:03 GMT
|
|
dabs
Full Member
Posts: 78
|
Post by dabs on Jun 24, 2019 13:43:10 GMT
The problem seems to be related to AsyncHttp, at least it looks like that when the logs from the server were examined in close detail.
I'm currently working on switching over to Rho::Network. I had initially thought that the callback was a function pointer, but since it is an url string I can simply append the callback parameters to it.
Or at least that is the theory. I am getting an error similar to this one:
Call InternetConnect failed. Url:/app/MyModel/someMethod?reccnt=0&back=&c=js&m=MyModel&e=0&rho_callback=1&http_error=200&headers={"content-length"=>"20", "content-type"=>"application/json; charset=utf-8", "date"=>"Mon, 24 Jun 2019 13:23:51 GMT", "server"=>"Microsoft-HTTPAPI/2.0"}. With code : 123
The method in question (i.e. MyModel::someMethod) exists, and this was working when we were using AsyncHttp.
Any idea what could cause this? What does code 123 mean in this context?
Regards, Daníel
|
|
|
Post by Alex Epifanov on Jun 24, 2019 14:11:03 GMT
Do you have any extended log for the error, and what is your app platform and exact Rhodes version?
|
|
dabs
Full Member
Posts: 78
|
Post by dabs on Jun 24, 2019 15:40:53 GMT
I don't have access to the device log. These lines from the server (which receives the requests from the device) do however indicate that there are 10 attempts, all with (almost exactly) one minute interval:
2019-06-18 15:09:43,473 [11] DEBUG Main - Incoming request: POST http://ipaddress:8081/orders/ 2019-06-18 15:10:43,596 [12] DEBUG Main - Incoming request: POST http://ipaddress:8081/orders/ 2019-06-18 15:11:43,785 [10] DEBUG Main - Incoming request: POST http://ipaddress:8081/orders/ 2019-06-18 15:12:43,923 [12] DEBUG Main - Incoming request: POST http://ipaddress:8081/orders/ 2019-06-18 15:13:44,085 [10] DEBUG Main - Incoming request: POST http://ipaddress:8081/orders/ 2019-06-18 15:14:44,264 [13] DEBUG Main - Incoming request: POST http://ipaddress:8081/orders/ 2019-06-18 15:15:44,420 [11] DEBUG Main - Incoming request: POST http://ipaddress:8081/orders/ 2019-06-18 15:16:44,579 [12] DEBUG Main - Incoming request: POST http://ipaddress:8081/orders/ 2019-06-18 15:17:44,758 [10] DEBUG Main - Incoming request: POST http://ipaddress:8081/orders/ 2019-06-18 15:18:44,912 [12] DEBUG Main - Incoming request: POST http://ipaddress:8081/orders/
Our devices are running Android 8.1. The app is built using Rhomobile 5.5.0.52.
|
|
dabs
Full Member
Posts: 78
|
Post by dabs on Jun 24, 2019 15:45:55 GMT
Oh wait sorry, I'm still talking about the previous error. I'll get the logs for this new error in a moment.
|
|
dabs
Full Member
Posts: 78
|
Post by dabs on Jun 24, 2019 16:10:00 GMT
...aaaand of course this led me to find the error :-)
The headers from a previous request were being appended as query string parameters to the next one, and this didn't go down well. Fixed that error, and now everything goes smoothly using Rho::Network.
Thanks for the help!
|
|
dabs
Full Member
Posts: 78
|
Post by dabs on Jun 25, 2019 10:24:16 GMT
OK this is very strange. I've switched to Rho::Network, but the requests are still coming in multiple times. Would this be a feature of some lower level component in 5.5, which is used by both Rho::Network and Rho::AsyncHttp?
|
|
|
Post by Alex Epifanov on Jun 25, 2019 13:41:13 GMT
Request should fire just once if there are no connectivity issues. That's strange. If you can get a sample app to demonstrate the issue or get the logs ( with net_trace=1 and MinSeverity=0) it would be helpful.
|
|