Throwing exceptions when after few minutes with no interaction
axenteoctavian opened this issue ยท 13 comments
I am connecting to my wallet with something like this:
_client = await WalletConnectSignClient.Init(_dappOptions);
_walletConnectV2 = await _client.Connect(_dappConnectOptions);
_walletConnectV2Session = await _walletConnectV2.Approval;
There are 2 errors that happen after some time of inactivity doing nothing:
1.
- When this happens, the storage file is broken and will throw errors after I start the application again
Thank you! ๐
Similar here. I've the stack trace from the Godot Debugger. This seems to happen regardless of whether the QR code is scanned or ignored (Approval
method passing)
E 0:08:09:0026 :0 @ void WalletConnectSharp.Network.Websocket.WebsocketConnection.OnOpen(Websocket.Client.WebsocketClient ): System.NullReferenceException: Object reference not set to an instance of an object.
<C++ Error> System.NullReferenceException
<C++ Source> :0 @ void WalletConnectSharp.Network.Websocket.WebsocketConnection.OnOpen(Websocket.Client.WebsocketClient )
<Stack Trace> :0 @ void WalletConnectSharp.Network.Websocket.WebsocketConnection.OnOpen(Websocket.Client.WebsocketClient )
:0 @ void WalletConnectSharp.Network.Websocket.WebsocketConnection+<Register>d__21.MoveNext()
:0 @ void System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
:0 @ void System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task )
:0 @ void System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task )
:0 @ void WalletConnectSharp.Network.Websocket.WebsocketConnection+<Open>d__19.MoveNext()
:0 @ void System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
:0 @ void System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task )
:0 @ void System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task )
:0 @ void WalletConnectSharp.Network.JsonRpcProvider+<Connect>d__19.MoveNext()
:0 @ void System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
:0 @ void System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task )
:0 @ void System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task )
:0 @ void WalletConnectSharp.Network.JsonRpcProvider+<Connect>d__21.MoveNext()
:0 @ void System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
:0 @ void System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task )
:0 @ void System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task )
:0 @ void WalletConnectSharp.Core.Controllers.Relayer+<<RegisterEventListeners>b__36_2>d.MoveNext()
:0 @ void System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
:0 @ void System.Threading.Tasks.Task+<>c.<ThrowAsync>b__128_1(System.Object )
:0 @ Boolean System.Threading.ThreadPoolWorkQueue.Dispatch()
:0 @ void System.Threading.PortableThreadPool+WorkerThread.WorkerThreadStart()
:0 @ void System.Threading.Thread.StartCallback()
I have the same issue too. Though I'm attempting with Blazor WASM...
EDIT: Disregard this. I'm trying to scan with the Loopring Wallet which only supports Sign V1...
This has been fixed in 2.0.5 can you confirm?
This has been fixed in 2.0.5 can you confirm?
Hi @gigajuwels!
The SDK is not throwing the exceptions mentioned above anymore.
But something is happening behind the scenes (every minute there are some exceptions happening)
What I can see is that these exceptions behind the scenes are affecting the requests/events
It will crash if I call _client.Disconnect(...)
and the afferent event is not triggered
_client.On(SESSION_DELETE, delegate ()
{
OnSessionDeleteEvent?.Invoke(this, EventArgs.Empty);
});
also if I use _client.Request<T, TR>(...)
I get the request on my phone but the response is not received by the SDK
Still have the same issue. As written in the referenced posts above.
@skibitsky the issue is not really resolved for me on version 2.1.1
This is kind of an old issue, I created a new one some time ago but @gigajuwels closed it.
Look at these steps to reproduce the broken connection
#117 (comment)
It has been almost 8 months since I posted this issue and is still not resolved. Please let me know if you need any more info.
Thank you! ๐
Thanks, @axenteoctavian!
This issue was caused by WebSocket.Client
library used by WalletConnectSharp. Initially I was unable to reproduce it in WalletConnectUnity because in Unity we use another library for websockets.
I've opened a PR #141 with a potential fix. Could you please check if it resolves the issue for you?
Hi @skibitsky!
This PR got something right.
But in my tests now, the same thing happens but after 5 minutes.๐
Thanks, @axenteoctavian!
I was able to reproduce and fix the issue in the same PR. WebSocket reconnection logic was broken.
Hi @skibitsky!
I'm trying to use WalletConnectUnity and I think this issue still persists.
If I understand correctly after the socket is closed the Relayer should attempt to reconnect and all the commutication should return to normal.
I've added this to WCWebSocket to reproduce the issue
void Update()
{
//This part to reproduce the issue
i++;
if (i % 5000 == 0)
Close();
// - This part to reproduce the issue
#if !UNITY_WEBGL || UNITY_EDITOR
if (_socket != null)
_socket.DispatchMessageQueue();
#endif
}
After the the socket disconnects though it shows a log from JsonRpcProvider that the connection is opening no further communication is possible. New calls to SignClient.Connect() don't work.
I'm testing this because the disconnect still happens automatically after some time.
Maybe I'm doing somthing wrong and you can help with this. Thanks!
Hi @vorberohus,
Your are right, and sorry for that. WalletConnectUnity and WalletConnectSharp aren't in full sync, I wanted to push one more PR before making release and merging it into WalletConnectUnity.
I've just merged v2.1.2 into WalletConnectUnity, it will fix the issue for you.
Thanks, @axenteoctavian!
I was able to reproduce and fix the issue in the same PR. WebSocket reconnection logic was broken.
Hi @skibitsky!
This error happens again starting with version 2.1.3.
After 5 mins without interaction, the request is received in my wallet, but the response is not coming back.
Thank you!