DeviceFarmer / stf

Control and manage Android devices from your browser.
https://devicefarmer.github.io
Other
3.48k stars 491 forks source link

When the window connected to STF is minimized, 'Terminated' occurs approximately 5 minutes later. #764

Closed QA-Jihyun closed 7 months ago

QA-Jihyun commented 7 months ago
  1. Execute STF. sudo stf local --port 8222 --public-ip 111.222.333.444 --no-cleanup --group-timeout 299999 --allow-remote --auth-type ldap --auth-options '["--ldap-url","ldap://111.222.333.444:8111","--ldap-bind-dn","cn=admin,dc=test,dc=com","--ldap-bind-credentials","test!@#$","--ldap-search-dn","dc=test,dc=com","--ldap-search-field","email"]'

  2. Log in via LDAP.

  3. STF > Use the device.

  4. Minimize the browser window connected to STF. 'terminated' is recorded in the STF log.

  5. Approximately 5 minutes later, maximize the browser window connected to STF and log out.

  6. An error occurs upon attempting to log back into STF.

INF/device:plugins:screen:stream 19924 [R39M10EC2RZ] minicap says: "Terminated " 2024-04-02T01:54:56.563Z INF/auth-ldap 19914 [::ffff:127.0.0.1] Authenticated "test@test.com"

node:events:496 throw er; // Unhandled 'error' event ^ ConnectionError: 3ldap://111.222.333.444:8111 closed at /Users/device/.nvm/versions/node/v20.11.0/lib/node_modules/@devicefarmer/stf/node_modules/ldapjs/lib/client/client.js:1277:17 at Array.forEach () at Client._onClose (/Users/device/.nvm/versions/node/v20.11.0/lib/node_modules/@devicefarmer/stf/node_modules/ldapjs/lib/client/client.js:1272:19) at Object.onceWrapper (node:events:633:26) at Socket.emit (node:events:518:28) at TCP. (node:net:337:12) Emitted 'error' event at: at sendResult (/Users/device/.nvm/versions/node/v20.11.0/lib/node_modules/@devicefarmer/stf/node_modules/ldapjs/lib/client/client.js:1389:22) at messageCallback (/Users/device/.nvm/versions/node/v20.11.0/lib/node_modules/@devicefarmer/stf/node_modules/ldapjs/lib/client/client.js:1423:16) at /Users/device/.nvm/versions/node/v20.11.0/lib/node_modules/@devicefarmer/stf/node_modules/ldapjs/lib/client/client.js:1277:14 at Array.forEach () [... lines matching original stack trace ...] at TCP. (node:net:337:12) { lde_message: '3ldap://111.222.333.444:8111 closed', lde_dn: null }

Node.js v20.11.0 2024-04-02T01:54:56.577Z FTL/cli:local 19902 [] Child process had an error ExitError: Exit code "1" at ChildProcess. (/Users/device/.nvm/versions/node/v20.11.0/lib/node_modules/@devicefarmer/stf/lib/util/procutil.js:49:23) at ChildProcess.emit (node:events:518:28) at ChildProcess._handle.onexit (node:internal/child_process:294:12) 2024-04-02T01:54:56.577Z INF/cli:local 19902 [] Shutting down all child processes 2024-04-02T01:54:56.580Z INF/util:lifecycle 19908 [app001] Winding down for graceful exit 2024-04-02T01:54:56.580Z INF/util:lifecycle 19909 [dev001] Winding down for graceful exit 2024-04-02T01:54:56.580Z INF/util:lifecycle 19910 [proc001] Winding down for graceful exit 2024-04-02T01:54:56.580Z INF/util:lifecycle 19915 [] Winding down for graceful exit 2024-04-02T01:54:56.580Z INF/util:lifecycle 19912 [reaper001] Winding down for graceful exit 2024-04-02T01:54:56.580Z INF/util:lifecycle 19911 [proc002] Winding down for graceful exit 2024-04-02T01:54:56.580Z INF/util:lifecycle 19918 [] Winding down for graceful exit 2024-04-02T01:54:56.580Z INF/util:lifecycle 19913 [] Winding down for graceful exit 2024-04-02T01:54:56.580Z INF/util:lifecycle 19917 [] Winding down for graceful exit 2024-04-02T01:54:56.581Z INF/util:lifecycle 19916 [] Winding down for graceful exit 2024-04-02T01:54:56.583Z INF/provider 19913 [] Cleaning up device worker "R39M10EC2RZ" 2024-04-02T01:54:56.583Z INF/provider 19913 [] Gracefully killing device worker "R39M10EC2RZ" 2024-04-02T01:54:56.583Z INF/util:lifecycle 19924 [R39M10EC2RZ] Winding down for graceful exit 2024-04-02T01:54:56.584Z INF/device:plugins:screen:stream 19924 [R39M10EC2RZ] Requesting frame producer to stop 2024-04-02T01:54:56.585Z WRN/db 19915 [] Connection closed 2024-04-02T01:54:56.585Z IMP/device:plugins:group 19924 [R39M10EC2RZ] No longer owned by "test@test.com" 2024-04-02T01:54:56.585Z INF/device:plugins:group 19924 [R39M10EC2RZ] Unsubscribing from group channel "Lr8efMOCSQKk3RvNC13d5Q==" 2024-04-02T01:54:56.587Z WRN/db 19918 [] Connection closed 2024-04-02T01:54:56.587Z WRN/db 19916 [] Connection closed 2024-04-02T01:54:56.587Z WRN/db 19911 [proc002] Connection closed 2024-04-02T01:54:56.587Z WRN/db 19910 [proc001] Connection closed 2024-04-02T01:54:56.587Z WRN/db 19912 [reaper001] Connection closed 2024-04-02T01:54:56.589Z WRN/db 19917 [] Connection closed 2024-04-02T01:54:56.594Z INF/provider 19913 [] Device worker "R39M10EC2RZ" has retired

What additional settings need to be configured, or which part is misconfigured?

QA-Jihyun commented 7 months ago

sudo /usr/libexec/slapd -h ldap://111.222.333.444:8111 -d 50 660d021f @(#) $OpenLDAP: slapd 2.4.28 (Nov 12 2023 01:03:52) $ root@rsl4p.p1s.plx.sd.apple.com:/AppleInternal/Library/BuildRoots/0032d1ee-80fd-11ee-8227-6aecfccc70fe/Library/Caches/com.apple.xbs/Binaries/OpenLDAP/install/TempContent/Objects/servers/slapd 660d021f daemon: SLAP_SOCK_INIT: dtblsize=256 660d0220 main: Enabling TLS failed; continuing with TLS disabled. 660d0220 slapd starting 660d0220 daemon: posting com.apple.slapd.startup notification ... 660d0253 <= test_filter 5 660d0253 <= test_filter_and 5 660d0253 <= test_filter 5 0000: 30 0c 02 01 03 61 07 0a 01 00 04 00 04 00 0....a........ ldap_write: want=14, written=14 0000: 30 0c 02 01 03 61 07 0a 01 00 04 00 04 00 0....a........ ldap_read: want=8, got=7 0000: 30 05 02 01 04 42 00 0....B. ber_dump: buf=0x600001ae4000 ptr=0x600001ae4000 end=0x600001ae4005 len=5 0000: 02 01 04 42 00 ...B. ldap_read: want=8 error=Resource temporarily unavailable

denis99999 commented 7 months ago

@QA-Jihyun, do you meet this issue using mock authentication ?

QA-Jihyun commented 7 months ago

@QA-Jihyun, do you meet this issue using mock authentication ?

Are you asking what happens when you log in with a mock stf?

As a result of confirmation, in the mock (stf local), Connection closed did not occur even if login>logout>login>logout was repeated many times.

denis99999 commented 7 months ago

@QA-Jihyun , what is your OS ? Can you build STF using NodeJS 17.9.0 and tell me if you get the same issue ?

QA-Jihyun commented 7 months ago

You are using a MAC OS that was not recommended by you in your last inquiry. Node is version 20. Is it optimized for Node Version 17?

@QA-Jihyun , what is your OS ? Can you build STF using NodeJS 17.9.0 and tell me if you get the same issue ?

denis99999 commented 7 months ago

Yes, Mac OS is not recommended, but it seems your issue is not a STF one but due to the LDAP configuration on your mac OS. Regarding your LDAP configuration, try "--ldap-search-field","uid" ?

QA-Jihyun commented 7 months ago

Yes, Mac OS is not recommended, but it seems your issue is not a STF one but due to the LDAP configuration on your mac OS. Regarding your LDAP configuration, try "--ldap-search-field","uid" ?

"--ldap-search-field","uid" also gives the same error. I think I'm going crazy 🚨

AND node 17 is same result....

browser is "111.222.333.444:8222?jwt=eyJhbGciOiJlUz|1NilsImV4cCI6MTcxMjE5NDE5NzQwOX0.eyJIbWFpbCI6|mhc3R3Y WIOQGdyaXBjb3JwLmNvliwibmFtZSI6In|vdW4ifQ.M3QMJ_Zk7|mute7JOys4NtQk1a- 906W7j6Dwbx기_wo" error. it is stf WT(JSON Web Token decryption) error?

denis99999 commented 7 months ago

@QA-Jihyun , please give your ldap configuration files, on Linux there are /etc/ldap/ldap.conf and /etc/default/slapd

denis99999 commented 7 months ago

@QA-Jihyun , you have to review your LDAP configuration because I don't see consistency with the STF LDAP client configuration (binddn, IP address, ...), did you test your LDAP server outside STF context ? For information, as your LDAP server seems to be located on the same machine as your STF server, you can use localhostaddress. In short this not a STF issue but a LDAP configuration one, sorry but I can't help you further.

denis99999 commented 7 months ago

@QA-Jihyun , I note in your ldap.conf the BASEand BINDDN variables dont' match your database schema (i.e. dc=test instead of dc=grip), moreover the --ldap-search-field option should point towards an attribute valued with the user name (i.e. not the user mail), this is why you should set this option with the uid attribute (i.e. not mail attribute) and adapt your database schema accordingly, for instance here is .ldif template file for add a user:

dn: cn=_USERNAME_,dc=test,dc=local
uid: _USERNAME_
sn: _USERNAME_
mail: _EMAIL_
objectClass: inetOrgPerson
objectClass: top
userPassword: _PASSWORD_
QA-Jihyun commented 7 months ago

@QA-Jihyun , I note in your ldap.conf the BASEand BINDDN variables dont' match your database schema (i.e. dc=test instead of dc=grip), moreover the --ldap-search-field option should point towards an attribute valued with the user name (i.e. not the user mail), this is why you should set this option with the uid attribute (i.e. not mail attribute) and adapt your database schema accordingly, for instance here is .ldif template file for add a user:

dn: cn=_USERNAME_,dc=test,dc=local
uid: _USERNAME_
sn: _USERNAME_
mail: _EMAIL_
objectClass: inetOrgPerson
objectClass: top
userPassword: _PASSWORD_
  1. There was no problem when I connected stf-ldap to a computer (Computer B) other than the computer on which I ran stf (Computer A) and then logged in>Logout>Login.

In the end I formatted the computer where the error occurred and the error did not occur.

Thanks for your help