Race condition - on user.leave if authenticated with pair #725
Comments
|
Yes, this is a bug, I agree this is a poor design. Any good ideas on how I could improve/change this without dropping support for a secure enclave? If a user logs out of the browser / hardware wallet / extension / enclave, then the But if a If you think if something, please let me know. It is causing some other race conditions I'd like to address too. |
|
I think the issue is that we have seperate user.auth and user.get steps, i.e. the state is carried a global variable. My preference would be that If its too late for that change, then I guess heavy documentation would be useful, but since basic documentation is missing, Im not sure that is possible :-( As a race of course, this makes for horendous debugging if you don't realize what is happening. |
|
Note - I've worked around this bug ... so its not a requirement for me, but couple odd behavior and poor documentation and you've got a high likelyhood of other people going down the rathole of trying to debug. |
|
It would also be superhelpful if |

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.

There appears to be a race condition....
If you are trying to do a: user.auth(pair) then user.get.put; user.leave
Then it works if, and only if, you wait for the ack on the put,
If you don't wait for the ack, then you get a "No! Unverified Data" message, probably because with Gun's state its no longer logged in.
Personally ... I think its a bug/design flaw that Gun uses state in the global user to represent logged in, rather than state which is determined at the time the put is invoked, but if that is intended behavior, then this is probably just. documentation bug.
Note .... for some weird reason, this ONLY happens if you
user.auth(pair)and not if youuser.auth(alias, password).Also ... same problem if you do a authenticate as a different user without waiting for the Ack (which was actually the problem I was hitting), but I think the 2nd authentication probably does an implicit leave.
The text was updated successfully, but these errors were encountered: