Closed Callepo closed 10 months ago
@insthync Tested with Mysql also, it throws the Invalid Acces Token there too, but obviously net the Nested transaction error from sqlite. it just shows acces token issue now.
Mysql DB
@insthync oh i should mention this is on a Server ( Linux Build) Local it happens also but not as easy.. you have to keep logging in/ logging out for a while, 2 accounts open and then it gets the error
[Local clients connected to local server]
IDK if 2 accounts is even the issue, but thats how i can reproduce it faster
Error log for mysql please
@insthync when using mysql the databasemanager doesnt show any error like the SQLite did, just central creates a log file with acces token issue. ill try and debug it and see if i can catch an error
@insthync The update user count throw the same error as the 2 other ones we fixed before where the value wasnt nullable
Ill see what else i can find
@insthync
2nd one for Validate Acces Token
@insthync ERROR RestDatabaseClient [2023-10-02 13:44:52] - Cannot UpdateCharacterAsync status: 500 ERROR MapNetworkManager(MapNetworkManager) [2023-10-02 13:45:12] - Invalid access token for user: ERROR No Tag [2023-10-02 13:45:22] - Can't deserialize content: , Newtonsoft.Json.JsonSerializationException: No JSON content found and type 'MultiplayerARPG.MMO.CharacterResp' is not nullable. Path '', line 0, position 0. at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize (Newtonsoft.Json.JsonReader reader, System.Type objectType, System.Boolean checkAdditionalContent) [0x000db] in <29e3dfd7379d434ca9881f8263fe42fe>:0 at Newtonsoft.Json.JsonSerializer.DeserializeInternal (Newtonsoft.Json.JsonReader reader, System.Type objectType) [0x00054] in <29e3dfd7379d434ca9881f8263fe42fe>:0 at Newtonsoft.Json.JsonSerializer.Deserialize (Newtonsoft.Json.JsonReader reader, System.Type objectType) [0x00000] in <29e3dfd7379d434ca9881f8263fe42fe>:0 at Newtonsoft.Json.JsonConvert.DeserializeObject (System.String value, System.Type type, Newtonsoft.Json.JsonSerializerSettings settings) [0x0002d] in <29e3dfd7379d434ca9881f8263fe42fe>:0 at Newtonsoft.Json.JsonConvert.DeserializeObject[T] (System.String value, Newtonsoft.Json.JsonSerializerSettings settings) [0x00000] in <29e3dfd7379d434ca9881f8263fe42fe>:0 at UnityRestClient.RestClient+Result`1[T]..ctor (System.Int64 responseCode, System.Boolean isHttpError, System.Boolean isNetworkError, System.String stringContent, System.String error) [0x00044] in <9ae98d53e4264ad78b3cc0b287e7ff7f>:0
@insthync Rebuild all new again, test from the start
this is what central logs
And this is databasemanager
Seems the process from db is going fine, its send okObjectsSesult back as a Response to client..
but the response is False.
client is getting False. so player cant start game..
so the accestoken is being for some reason wiped or cant be read
but in the DB
its there.. so i thought it was maybe not caching properly so i put disabled caching on, and tried again.. it still giving the connection rejected from server.
So i think the mapnetworkmanager is sending wrong assestoken to the db to be checked, or its putting the value as null And when the db tries to validate it will be false.
@insthync im debugging the client to see which Acces token its sending back to server and i noticed when you press Exit in game, game loads home scene, and prints out acces token 1 time.. But sometimes it prints it out 2 times in a row..
When it does this 2 times, thats when you get connection rejected
Its sending 2 request to server OR server is processing the Exit 2 times and sending back 2 responses, and each process changes the token, so the 2nd change was on server making the token different than what the client has
@insthync
My Debug is inside OnCentralConnected
When logout, Db acces token is same as Debug log, when it print it out 2 times, when the connection rejected occurs.. The Db acces token is different from client
@insthync
Db manager get 2 request to validate acces token b2b, which makes it update the token in the db.
Look at the top and at the bottom, should only be 1 request and done. but Central server send 2 request, or Databasemanager thinks it got 2 for some reason
@insthync ?
?
Did you find why UIMmoSceneHome
-> OnCentralServerConnected
called twice, all this problem is not because of database manager at all.
If you can't find it, then easiest way to fix it is just not update access token when validate access token, do it by delete CentralNetworkManager_Login
-> HandleRequestValidateAccessToken
-> UpdateAccessTokenAsync
When you write the access token log, did you try to find a difference from its stack trace ?
And you don't have to tag me, it is already notified and send me an email.
Did you find why
UIMmoSceneHome
->OnCentralServerConnected
called twice, all this problem is not because of database manager at all.If you can't find it, then easiest way to fix it is just not update access token when validate access token, do it by delete
CentralNetworkManager_Login
->HandleRequestValidateAccessToken
->UpdateAccessTokenAsync
removing it would fix the issue yes, but is there a specific reason why the accestoken was being changed everytime u press Exit ingame, instead only setting it once when u initially log in ?
And also this issue only happens when using the NET7 Services, not when running it the normal way. Even tho the same process is happening there. And yes, i said either central is calling it twice, or db manager thinks its receiving it twice. didnt fully know which one of the 2 it was precise.
When you write the access token log, did you try to find a difference from its stack trace ?
no i didnt. ill try and see if i can
Did you find why
UIMmoSceneHome
->OnCentralServerConnected
called twice, all this problem is not because of database manager at all. If you can't find it, then easiest way to fix it is just not update access token when validate access token, do it by deleteCentralNetworkManager_Login
->HandleRequestValidateAccessToken
->UpdateAccessTokenAsync
removing it would fix the issue yes, but is there a specific reason why the accestoken was being changed everytime u press Exit ingame, instead only setting it once when u initially log in ?
And also this issue only happens when using the NET7 Services, not when running it the normal way. Even tho the same process is happening there. And yes, i said either central is calling it twice, or db manager thinks its receiving it twice. didnt fully know which one of the 2 it was precise.
Because OnCentralServerConnected
is called twice, and in that function, it calls a function to validate the access token, and then when the validating it will change to a new access token, so the problem occurs.
You may include Time.framecount in the log message to see if it is being called in the same frame or not.
I think I will remove the update access token in the validate function because it is actually not necessary.
Did you find why
UIMmoSceneHome
->OnCentralServerConnected
called twice, all this problem is not because of database manager at all. If you can't find it, then easiest way to fix it is just not update access token when validate access token, do it by deleteCentralNetworkManager_Login
->HandleRequestValidateAccessToken
->UpdateAccessTokenAsync
removing it would fix the issue yes, but is there a specific reason why the accestoken was being changed everytime u press Exit ingame, instead only setting it once when u initially log in ? And also this issue only happens when using the NET7 Services, not when running it the normal way. Even tho the same process is happening there. And yes, i said either central is calling it twice, or db manager thinks its receiving it twice. didnt fully know which one of the 2 it was precise.
Because
OnCentralServerConnected
is called twice, and in that function, it calls a function to validate the access token, and then when the validating it will change to a new access token, so the problem occurs.
Correct, i understand, But what would be the reason it only happens with the Net7 Services? cuase the same codes are there for the Unity Server too
And what was the original Reason the accestoken was set to change everytime we validate the token? was this needed for something? and removing the update part would cuase an issue? or it was just done for no reason,
You may include Time.framecount in the log message to see if it is being called in the same frame or not.
I think I will remove the update access token in the validate function because it is actually not necessary.
ah ok ok, u already answered the Validate question here, cool, removing it would fix the issue we have tho yes
Maybe .Net service is faster and access token is changed before the next request.
@insthync![image](https://github.com/suriyun-mmorpg/UnityMultiplayerARPG_DatabaseManager/assets/7702658/115478a8-f764-4016-880c-106690ff125f)
When 2 clients connected, this error is thrown in databasemanager Console