Open obrasero opened 3 years ago
There is some problem with retroshare service.
So i just did the above but now by debugging in as.
Taken over in mine: #31 to debug on this state allready.
crashing request: (cause: connection refused)(as service is downed) the request exception gets not handled in: requestAccountCreation only response code return gets handled at account.dart l99 resulting in just client close which than lastly phenomenological for the user results into a rs-client endless cycling the processing wheel with no other reaction by the user on it possible: user view hanging. exception = {SocketException} SocketException: OS Error: Connection refused, errno = 111, address = localhost, port = 50266 request = {Request} POST http://localhost:9092/rsLoginHelper/createLocationV2 method = "POST" url = {_SimpleUri} http://localhost:9092/rsLoginHelper/createLocationV2 _contentLength = null _persistentConnection = true _followRedirects = true _maxRedirects = 5 headers = {_CompactLinkedCustomHashMap} {content-type: text/plain; charset=utf-8} _index = {_Uint32List} size = 8 _hashMask = 268435455 _data = {_List} size = 8 _usedData = 2 _deletedKeys = 0 _equality = {_Closure} Closure: (String, String) => bool _hasher = {_Closure} Closure: (String) => int _validKey = {_Closure} Closure: (dynamic) => bool from Function 'test':. _finalized = true _defaultEncoding = {Utf8Codec} _bodyBytes = {_Uint8List} size = 87 this = {IOClient} stream = {ByteStream}
If this is throwing you socket exception than it is the problem with retroshare service. because the UI part seems good to me.
yes in one way of view:
what do i need in my build system to build and debug the service itself?
and aside from this, debugging the code is making me slowly but definitly more familiar with the rs-mobile and flutter-dart code. so in any way at least a win to me ;)
Another thing: i think the client rs-mobile should, if not restarting the service by its own, at least allways tell the poore user what happens and how he can get it again into life. But as long as the service goes down in common cases this is not helping as it is not realy usable. so we will have to find out what to fix in this. maybe i have luck and my doings give the team the right idea, or?
@Kumaravinash9 ok. i listed above now the complete rquest and the reaction in the callstack upwards until user view. maybe it gives a hint.
do you now how a naive flutter-as beginner can setup an environment to debug the service itself? to get an idea why he socket refuses?
maybe some one know more about this issue @G10h4ck @sehraf @selankon @b1rdG
Hey!
I saw in your exception this:
exception = {SocketException} SocketException: OS Error: Connection refused, errno = 111, address = localhost, port = 50266
Seem that is trying to connect to the port 50266
, usually RS service run on 9092
. But then at the POST operation you are pointing correctly the port 9092.
Some tricks:
To debug RetroShare on the phone you can use:
adb logcat | grep -i retro
Also you can do curl calls from the computer via adb using, this can help you to debug:
adb forward tcp:9091 tcp:9092
curl -u http://127.0.0.1:9091/RsJsonApi/version -vv
Try to debug further and paste the results
And about that:
i think the client rs-mobile should, if not restarting the service by its own, at least allways tell the poore user what happens and how he can get it again into life.
We resolve it here.
@selankon To debug RetroShare on the phone
I debug it with android studio on the phone.
Ok, tomorrow i will again debug it step by step.
We resolve it here.
As i understood, this is up to restart the downed service automatic again:OK In my tests the service most time goes down, nearly every action with rs-mobile lets the service randomly go down. Sometimes the action works without going him down bust lot more than sporadic it goes down.
Are you aware or do you know that the service stay active in the background an endless time if no rs-mobile is active/installed also if you work with other apps in the phone meanwhile. I documented this with Test: #33 So by my tests it seems always any "side-effect" between the service and the rs-mobile which forces the service down happen.
I debug it with android studio on the phone.
Yes but you are debugging the flutter app, not the retroshare service, youshould know why RS service fall if its falling.
To mantain a service up, on android, you will need to run this service as a foreground application, using an android notification to mantain it up.
On elrepo.io, we bundle the retroshare service apk on the flutter app and make it runing as foreground application. I think you will find how to do it on the issue i quoted. Otherwhise ask me of how to do this process.
If you dont do that, androidOS will set the service in idle status or something similar after a while, stopping RS servic until focus.
https://developer.android.com/guide/components/foreground-services
I debug it with android studio on the phone.
Yes but you are debugging the flutter app, not the retroshare service, youshould know why RS service fall if its falling.
To mantain a service up, on android, you will need to run this service as a foreground application, using an android notification to mantain it up.
On elrepo.io, we bundle the retroshare service apk on the flutter app and make it runing as foreground application. I think you will find how to do it on the issue i quoted. Otherwhise ask me of how to do this process.
If you dont do that, androidOS will set the service in idle status or something similar after a while, stopping RS servic until focus.
https://developer.android.com/guide/components/foreground-services
Hii @selankon , Actually the problem with the retroshare service.Not with the retroshare mobile UI. I have tested it many times. One more help I need from your side that can you help me to create a new retroshare service mobile apk through retroshare repo.
Could you please send me the proper steps how to compile the new retroshare service apk. Thanks
Could you please send me the proper steps how to compile the new retroshare service apk. Thanks
Yes, as is asked above also "do you now how ... can setup an environment to debug the service itself?" that would be very good/helpfull.
Could you please send me the proper steps how to compile the new retroshare service apk. Thanks
Yes, as is asked above also "do you now how ... can setup an environment to debug the service itself?" that would be very good/helpfull.
Hi,
To debug service itself, as i suggested, use abive, use :
adb logcat | grep -i retro
And you can do curl
to check responses.
Could you please send me the proper steps how to compile the new retroshare service apk
@G10h4ck do the compilation. Maybe can help.
In the following days I could do a step by step guidw of how to integrate retroshare apk inside a flutter apk and execute it as foreground service.
@selankon To debug service itself, as i suggested, use abive, use :
adb logcat | grep -i retro
Ahh..., now the android-studio newbie got it :) I did have to open a cmd in the dir of the android platform tools OK. i got now the trace so will now look through.... be patient with the slow newbie to get your hint ;)
OK i now did a new test-run with the rs-mobile from avin's master: Actual a no more socket exceptions pop up like the last time always. Instead now an "Unhandled Exception: Connection closed before full header was received" always appears on first account creation. With the same result: nor first account/profile is creatable.
Attached the adb trace:
https://stackoverflow.com/questions/55879550/how-to-fix-httpexception-connection-closed-before-full-header-was-received @obrasero could you please try this
Thanks for the hint, but sadly flutter clean doesnt fix it. and it happens to me on physical device in release and debug builds.
But i checked out your new master and build tested with it: Don't know why but with this the "before full header" did not happen in profile/account-creation, so now i was able to create an account with just before manually restarting the service. but while playing around it happened at other actions as well as the socket exception. but always manually starting the service before next action i was at least able to created identities.
Socket exception comes because of this reason
More commonly, it is caused by writing to a connection that the other end has already closed normally. In other words an application protocol error. It can also be caused by closing a socket when there is unread data in the socket receive buffe
Could you please send me the proper steps how to compile the new retroshare service apk. Thanks
Yes, as is asked above also "do you now how ... can setup an environment to debug the service itself?" that would be very good/helpfull.
Hi,
To debug service itself, as i suggested, use abive, use :
adb logcat | grep -i retro
And you can do
curl
to check responses.Could you please send me the proper steps how to compile the new retroshare service apk
@G10h4ck do the compilation. Maybe can help.
In the following days I could do a step by step guidw of how to integrate retroshare apk inside a flutter apk and execute it as foreground service.
Hi @selankon , Could you please help me to do this ?
@Kumaravinash9 I wrote this guide of how to bundle RS service as Android Foreground service
https://gitlab.com/elRepo.io/elRepo.io-android/-/issues/43
Probably I forgot stuff, write me a comment there if need to ask
Thanks @selankon. And can you help me to debug this login problem. Actually from my side i pointed port at 9092 but still comes socket exception.
Please @Kumaravinash9 provide related information:
curl
working? If not, use -vv
version and paste the trace here. Remember you will need to do a port forwarding from adb as show above. Maybe Android bring down the RetroShare service into a idle state? Please provide as much information as you can when asking for a solution.
@selankon Is curl working?
Yes, at least at my environment:
curl http://127.0.0.1:9091/RsJsonApi/version -v
* Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to 127.0.0.1 (127.0.0.1) port 9091 (#0)
> GET /RsJsonApi/version HTTP/1.1
> Host: 127.0.0.1:9091
> User-Agent: curl/7.55.1
> Accept: */*
>
< HTTP/1.1 200 OK
< Access-Control-Allow-Headers: Authorization,DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range
< Access-Control-Allow-Methods: GET, POST, OPTIONS
< Access-Control-Allow-Origin: *
< Access-Control-Expose-Headers: Content-Length,Content-Range
< Connection: close
< Content-Length: 116
< Content-Type: application/json
<
{
"major": 0,
"minor": 6,
"mini": 6,
"extra": "-38-g25f58bc10",
"human": "0.6.6-38-g25f58bc10"
}* Closing connection 0
.... What code are you building
Master of @Kumaravinash9, but as merge into my fork as dev/master: https://github.com/obrasero/retroshare-mobile/tree/dev/master
@selankon RS Service and flutter trace and errors
Appended a trace with socket error... trace socketexception.txt
..and here a trace with "Connection closed before full header was received" trace debug after f clean.txt
M... maybe activity manager is killing RetroShare service
08-08 11:39:50.759 694 1980 I ActivityManager: Process org.retroshare.service:rs (pid 28842) has died: fore SVC
@Kumaravinash9 are you trying to bundle both apks as shown in the guide? Maybe this fix the problem?
Could you try to do a curl call after a socket exception is thrown?
M... maybe activity manager is killing RetroShare service
08-08 11:39:50.759 694 1980 I ActivityManager: Process org.retroshare.service:rs (pid 28842) has died: fore SVC
@Kumaravinash9 are you trying to bundle both apks as shown in the guide? Maybe this fix the problem?
Could you try to do a curl call after a socket exception is thrown?
Yes working on it. will integrate it by tomorrow.
Update of the test upto #39:
Still not working on my phone, also the phenomenology changed. see: https://github.com/RetroShare/retroshare-mobile/pull/29#issuecomment-897859711
Instead of socket exception or "not finished header in async return"-exceptions now the exception is: "Exception: HttpException: Exception: something went wrong!"
but: the service stays now active or did not reach the point where it was until now downed, while rs-mobile hangs in state: get locations...
Test repeated with an emulated device: Results is the same: exception and hanging in Splash: "get locations..."
TC(TestCase): FAIL: Device: ZTE Blade A5 2019 (mobile) • android-arm • Android 9 (API 28)
apks
Steps: Create the first profile after install