Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TS(TestSet): FAIL: Create first profile after install service and rs-mobile #32

Open
obrasero opened this issue Aug 5, 2021 · 31 comments

Comments

@obrasero
Copy link
Contributor

obrasero commented Aug 5, 2021

TC(TestCase): FAIL: Device: ZTE Blade A5 2019 (mobile) • android-arm • Android 9 (API 28)

apks

Steps: Create the first profile after install

  1. OK: Copied both apks to the download section of mobile
  2. OK: In Download click Service and install
  3. OK: in Doenload click app-release.apk and install
  4. OK: in Apps find "R": click service app
    4.1. => show with START-Button
  5. OK: click START
    5.1. => shows STOP button
  6. OK: in Apps find "R": click rs mobile
    6.1. => FAIL: shows entry view to create profile
    • => {instead it shows Can' connect...}
  7. OK: in Apps find "R": click service app
    7.1 => FAIL: show still STOP
    • => {instead it shows START; the service got shut down as mosty - by crash or other reasoen i dont know}
@obrasero obrasero changed the title TS(TestSet): Create first profile after install service and rs-mobile TS(TestSet): FAIL: Create first profile after install service and rs-mobile Aug 5, 2021
@Kumaravinash9
Copy link
Contributor

There is some problem with retroshare service.

@obrasero
Copy link
Contributor Author

obrasero commented Aug 5, 2021

So i just did the above but now by debugging in as.

  • OK:service started
  • OK:Debug rs-mobile
  • OK: clienz got installed on mobile and started within start window.
  • OK: typed in the data to creater a first profile
  • OK: pushed: create it
    1. => AS-debugger running a while through the code than a Socket-Exception appeard
    2. => checking the state of the service in mobile: stoped.

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}

@Kumaravinash9
Copy link
Contributor

If this is throwing you socket exception than it is the problem with retroshare service. because the UI part seems good to me.

@obrasero
Copy link
Contributor Author

obrasero commented Aug 5, 2021

yes in one way of view:

  • the service should not crash/shutdown unawaited.
    but the question could be:
  • is the service godown caused by its alone only because of he has to process requests
  • or may it be that he goes down caused by delivered in any way invalid requests before this connection refused request.

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?

@obrasero
Copy link
Contributor Author

obrasero commented Aug 5, 2021

@Kumaravinash9
ok. i listed above now the complete rquest and the reaction in the callstack upwards until user view.
maybe it gives a hint.

@obrasero
Copy link
Contributor Author

obrasero commented Aug 5, 2021

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?

@defnax
Copy link

defnax commented Aug 6, 2021

maybe some one know more about this issue @G10h4ck @sehraf @selankon @b1rdG

@selankon
Copy link

selankon commented Aug 6, 2021

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.

@obrasero
Copy link
Contributor Author

obrasero commented Aug 6, 2021

@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.

@selankon
Copy link

selankon commented Aug 7, 2021

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

@Kumaravinash9
Copy link
Contributor

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.

@Kumaravinash9
Copy link
Contributor

Could you please send me the proper steps how to compile the new retroshare service apk. Thanks

@obrasero
Copy link
Contributor Author

obrasero commented Aug 7, 2021

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.

@selankon
Copy link

selankon commented Aug 7, 2021

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.

@obrasero
Copy link
Contributor Author

obrasero commented Aug 7, 2021

@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 ;)

@obrasero
Copy link
Contributor Author

obrasero commented Aug 7, 2021

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:


trace.txt

@Kumaravinash9
Copy link
Contributor

@obrasero
Copy link
Contributor Author

obrasero commented Aug 8, 2021

Thanks for the hint,
but sadly flutter clean doesnt fix it.
and it happens to me on physical device in release and debug builds.

@obrasero
Copy link
Contributor Author

obrasero commented Aug 8, 2021

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.

@Kumaravinash9
Copy link
Contributor

Kumaravinash9 commented Aug 8, 2021

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

@Kumaravinash9
Copy link
Contributor

Kumaravinash9 commented Aug 8, 2021

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 ?

@selankon
Copy link

selankon commented Aug 9, 2021

@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

@Kumaravinash9
Copy link
Contributor

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.

@selankon
Copy link

selankon commented Aug 9, 2021

Please @Kumaravinash9 provide related information:

  • What code are you building?
  • RS Service and flutter trace and errors
  • Is 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.

@obrasero
Copy link
Contributor Author

obrasero commented Aug 9, 2021

@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

@obrasero
Copy link
Contributor Author

obrasero commented Aug 9, 2021

@selankon
RS Service and flutter trace and errors

Appended a trace with socket error...
trace socketexception.txt

@obrasero
Copy link
Contributor Author

obrasero commented Aug 9, 2021

..and here a trace with "Connection closed before full header was received"
trace debug after f clean.txt

@selankon
Copy link

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?

@Kumaravinash9
Copy link
Contributor

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.

@obrasero
Copy link
Contributor Author

obrasero commented Aug 13, 2021

Update of the test upto #39:

Still not working on my phone,
also the phenomenology changed.
see: #29 (comment)

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...

@obrasero
Copy link
Contributor Author

Test repeated with an emulated device:
Results is the same: exception and hanging in Splash: "get locations..."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants