Auties00 / Cobalt

Standalone unofficial fully-featured Whatsapp Web and Mobile API for Java and Kotlin
MIT License
661 stars 188 forks source link

Random Disconnect (3.4.1) #306

Closed GDB4J closed 1 year ago

GDB4J commented 1 year ago

Version 3.4.1

After a random period of time, the api disconnect itself No exception or stacktrace is logged

Reason DISCONNECTED

Api is not reconnecting itself... Or did i mis an option to do a reconnect when a "DISCONNECTED" happend?

Using Spring boot version "3.1.0"

Auties00 commented 1 year ago

I'll push a commit later today which fixes this issue

GDB4J commented 1 year ago

Hello! I am very interested in see how do you code the integration between spring boot and whatsapp4j. Could you provide a git repo or the code in some way?

Thank you !!

@jandreotti

Well, i don't think it's that difficult, as you have already done it by yourself. What do you want to know? Also, I think there are several ways to set this up in a springboot application...

Auties00 commented 1 year ago

Hello gdb4j! I was wondering what would be better:

  • Defining the connection and connect in a bean (and return the Whatsapp api object to autowire in the places we need it like controllers/services). (This way it keep connected always, this would be fine? / good practice?? )

  • Or do the connection each time we want it. (I think this would be better if we only use the library to notificate or send messages).

I am not sure! Thanks!

this was a problem before. Now if you start a connection it will remain active in the background and if you create a new connection from the same store and keys it will load the active one back up so the lifecycle is much easier to handle

GDB4J commented 1 year ago

Hello @jandreotti

You're idea of just making a connection when needed is probably the best and cleanest way to do this

That said, in my expierence so far, creating a connection is one thing this library is struggling the most in the past and current versions again (see my several issue reports on current version). Once there is a connection, sending message's to notificate is never failing. So, i'm creating the connection when booting the application by a event listener

Put this in your main spring boot class (also use @RequiredArgsConstructor annotation to "wire up your beans" most recommend way currently)

private final WhatsAppService whatsAppApiService;

@EventListener(ApplicationReadyEvent.class)
public void doSomethingAfterStartup() {
    LOG.debug("Application started!");
    whatsAppApiService.startWhatsAppConnection();
}

In the WhatsAppService Component(Add @Component Annotation) Define a public method "startWhatsAppConnection" where you setup you're connection. That way you can use WhatsAppService as a (Autowired (*)) bean where you want througout your entire application

(*) @Autowire is "not done" anymore in springboot 3.x (read some docs on it if you want)

Hope this helps you further

But i must admit, when creating or reestablishing a connection is stable and not a problem at all (but this is currently not the case), you're second approach would be best imho.

GDB4J commented 1 year ago

Hi @Auties00

Last few days i was running latest version (3.4.4) and got again disconnected while just be in "stand by" See below a time line and which errors are throwed

2023-06-06 01:13:23,163 | DEBUG | pool-2-thread-11 | xxx | [Whats App] Disconnect (whatsapp, reason)
2023-06-06 01:13:23,163 | DEBUG | pool-2-thread-11 | xxx | [Whats App] Disconnect reason: 'RECONNECTING'
2023-06-06 01:13:23,164 | DEBUG | pool-2-thread-11 | xxx | [Whats App] Disconnect (reason)
2023-06-06 01:13:23,164 | DEBUG | pool-2-thread-11 | xxx | [Whats App] Disconnect reason: 'RECONNECTING'
2023-06-06 01:13:23,165 | DEBUG | pool-2-thread-11 | xxx | Disconnected: RECONNECTING
2023-06-06 01:13:23,752 | ERROR | Thread-15945 | ErrorHandler | Socket failure at UNKNOWN
2023-06-06 01:13:23,752 | ERROR | Thread-15945 | xxx | WhatsApp Error: 'Cannot decrypt data using AesGMC: 068168fdbf24044db46183cd7579a75109f6f97513cefab569aa30d86c4dfa85f047158b9b4fb28da92933'
2023-06-06 01:13:23,752 | ERROR | Thread-15945 | xxx | Stacktrace: 
java.lang.RuntimeException: Cannot decrypt data using AesGMC: 068168fdbf24044db46183cd7579a75109f6f97513cefab569aa30d86c4dfa85f047158b9b4fb28da92933
    at it.auties.whatsapp.crypto.AesGmc.cipher(AesGmc.java:35)
    at it.auties.whatsapp.crypto.AesGmc.decrypt(AesGmc.java:48)
    at it.auties.whatsapp.crypto.AesGmc.decrypt(AesGmc.java:44)
    at it.auties.whatsapp.socket.SocketHandler.onMessage(SocketHandler.java:185)
    at it.auties.whatsapp.socket.SocketSession.readMessages(SocketSession.java:122)
    at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: org.bouncycastle.crypto.InvalidCipherTextException: mac check in GCM failed
    at org.bouncycastle.crypto.modes.GCMBlockCipher.doFinal(Unknown Source)
    at it.auties.whatsapp.crypto.AesGmc.cipher(AesGmc.java:32)
    ... 5 common frames omitted
2023-06-06 01:13:23,754 |  WARN | Thread-15945 | ErrorHandler | Ignored failure

However after this error, it seems like there was a successfull login afterwards

Some time later i noticed this errors several times (14 times, but each with different id's)

2023-06-07 01:06:48,130 | ERROR | Thread-47960 | ErrorHandler | Socket failure at MEDIA_CONNECTION
2023-06-07 01:06:48,131 | ERROR | Thread-47960 | xxx | WhatsApp Error: 'java.lang.RuntimeException: Node[description=iq, attributes={xmlns=w:m, to=s.whatsapp.net, id=5df563f7-ca2b-4f36-a0d0-1724458d621c, type=set}, content=[Node[description=media_conn]]] node timed out'
2023-06-07 01:06:48,131 | ERROR | Thread-47960 | xxx | Stacktrace: 
java.util.concurrent.CompletionException: java.lang.RuntimeException: Node[description=iq, attributes={xmlns=w:m, to=s.whatsapp.net, id=5df563f7-ca2b-4f36-a0d0-1724458d621c, type=set}, content=[Node[description=media_conn]]] node timed out
    at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:332)
    at java.base/java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:347)
    at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:636)
    at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510)
    at java.base/java.util.concurrent.CompletableFuture.completeExceptionally(CompletableFuture.java:2162)
    at it.auties.whatsapp.model.request.Request.cancelTimedFuture(Request.java:58)
    at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.RuntimeException: Node[description=iq, attributes={xmlns=w:m, to=s.whatsapp.net, id=5df563f7-ca2b-4f36-a0d0-1724458d621c, type=set}, content=[Node[description=media_conn]]] node timed out
    at it.auties.whatsapp.socket.SocketHandler.send(SocketHandler.java:432)
    at it.auties.whatsapp.socket.SocketHandler.send(SocketHandler.java:425)
    at it.auties.whatsapp.socket.SocketHandler.sendQuery(SocketHandler.java:421)
    at it.auties.whatsapp.socket.SocketHandler.sendQuery(SocketHandler.java:401)
    at it.auties.whatsapp.socket.StreamHandler.createMediaConnection(StreamHandler.java:853)
    at it.auties.whatsapp.socket.StreamHandler.lambda$createMediaConnection$74(StreamHandler.java:860)
    at java.base/java.util.concurrent.CompletableFuture.uniExceptionally(CompletableFuture.java:990)
    at java.base/java.util.concurrent.CompletableFuture$UniExceptionally.tryFire(CompletableFuture.java:974)
    at java.base/java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:482)
    ... 1 common frames omitted
2023-06-07 01:06:48,132 |  WARN | Thread-47960 | ErrorHandler | Ignored failure

Afterwards the connection was lost When trying to send a simple text message, i got this:

2023-06-07 10:54:05,497 | ERROR | Thread-48495 | ErrorHandler | Socket failure at MESSAGE
2023-06-07 10:54:05,498 | ERROR | Thread-48495 | xxx | WhatsApp Error: 'java.io.IOException: Cannot send Request[id=85e45b29-2ae1-43a3-9438-86f44828c54f, body=Node[description=iq, attributes={xmlns=usync, to=s.whatsapp.net, id=85e45b29-2ae1-43a3-9438-86f44828c54f, type=get}, content=[Node[description=usync, attributes={mode=query, last=true, context=message, index=0, sid=805baa60-5e79-47b9-aaed-f0e511f02f6d}, content=[Node[description=query, content=[Node[description=devices, attributes={version=2}]]], Node[description=list, content=[Node[description=user, attributes={jid=32469259740@s.whatsapp.net}], Node[description=user, attributes={jid=<jid>@s.whatsapp.net}]]]]]]], future=java.util.concurrent.CompletableFuture@56e19245[Not completed, 1 dependents], filter=null, caller=java.lang.RuntimeException: Node[description=iq, attributes={xmlns=usync, to=s.whatsapp.net, id=85e45b29-2ae1-43a3-9438-86f44828c54f, type=get}, content=[Node[description=usync, attributes={mode=query, last=true, context=message, index=0, sid=805baa60-5e79-47b9-aaed-f0e511f02f6d}, content=[Node[description=query, content=[Node[description=devices, attributes={version=2}]]], Node[description=list, content=[Node[description=user, attributes={jid=32469259740@s.whatsapp.net}], Node[description=user, attributes={jid=<jid>@s.whatsapp.net}]]]]]]] node timed out], an unknown exception occurred'
2023-06-07 10:54:05,498 | ERROR | Thread-48495 | xxx | Stacktrace: 
java.util.concurrent.CompletionException: java.io.IOException: Cannot send Request[id=85e45b29-2ae1-43a3-9438-86f44828c54f, body=Node[description=iq, attributes={xmlns=usync, to=s.whatsapp.net, id=85e45b29-2ae1-43a3-9438-86f44828c54f, type=get}, content=[Node[description=usync, attributes={mode=query, last=true, context=message, index=0, sid=805baa60-5e79-47b9-aaed-f0e511f02f6d}, content=[Node[description=query, content=[Node[description=devices, attributes={version=2}]]], Node[description=list, content=[Node[description=user, attributes={jid=32469259740@s.whatsapp.net}], Node[description=user, attributes={jid=<jid>@s.whatsapp.net}]]]]]]], future=java.util.concurrent.CompletableFuture@56e19245[Not completed, 1 dependents], filter=null, caller=java.lang.RuntimeException: Node[description=iq, attributes={xmlns=usync, to=s.whatsapp.net, id=85e45b29-2ae1-43a3-9438-86f44828c54f, type=get}, content=[Node[description=usync, attributes={mode=query, last=true, context=message, index=0, sid=805baa60-5e79-47b9-aaed-f0e511f02f6d}, content=[Node[description=query, content=[Node[description=devices, attributes={version=2}]]], Node[description=list, content=[Node[description=user, attributes={jid=32469259740@s.whatsapp.net}], Node[description=user, attributes={jid=<jid>@s.whatsapp.net}]]]]]]] node timed out], an unknown exception occurred
    at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:332)
    at java.base/java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:347)
    at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:636)
    at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510)
    at java.base/java.util.concurrent.CompletableFuture.completeExceptionally(CompletableFuture.java:2162)
    at it.auties.whatsapp.model.request.Request.onSendError(Request.java:137)
    at java.base/java.util.concurrent.CompletableFuture.uniExceptionally(CompletableFuture.java:990)
    at java.base/java.util.concurrent.CompletableFuture$UniExceptionally.tryFire(CompletableFuture.java:974)
    at java.base/java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:482)
    at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.io.IOException: Cannot send Request[id=85e45b29-2ae1-43a3-9438-86f44828c54f, body=Node[description=iq, attributes={xmlns=usync, to=s.whatsapp.net, id=85e45b29-2ae1-43a3-9438-86f44828c54f, type=get}, content=[Node[description=usync, attributes={mode=query, last=true, context=message, index=0, sid=805baa60-5e79-47b9-aaed-f0e511f02f6d}, content=[Node[description=query, content=[Node[description=devices, attributes={version=2}]]], Node[description=list, content=[Node[description=user, attributes={jid=32469259740@s.whatsapp.net}], Node[description=user, attributes={jid=<jid>@s.whatsapp.net}]]]]]]], future=java.util.concurrent.CompletableFuture@56e19245[Not completed, 1 dependents], filter=null, caller=java.lang.RuntimeException: Node[description=iq, attributes={xmlns=usync, to=s.whatsapp.net, id=85e45b29-2ae1-43a3-9438-86f44828c54f, type=get}, content=[Node[description=usync, attributes={mode=query, last=true, context=message, index=0, sid=805baa60-5e79-47b9-aaed-f0e511f02f6d}, content=[Node[description=query, content=[Node[description=devices, attributes={version=2}]]], Node[description=list, content=[Node[description=user, attributes={jid=32469259740@s.whatsapp.net}], Node[description=user, attributes={jid=<jid>@s.whatsapp.net}]]]]]]] node timed out], an unknown exception occurred
    ... 5 common frames omitted
Caused by: java.util.concurrent.CompletionException: java.io.UncheckedIOException: Cannot send message
    at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:315)
    at java.base/java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:320)
    at java.base/java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1807)
    ... 1 common frames omitted
Caused by: java.io.UncheckedIOException: Cannot send message
    at it.auties.whatsapp.socket.SocketSession.lambda$sendBinary$3(SocketSession.java:108)
    at java.base/java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1804)
    ... 1 common frames omitted
Caused by: java.net.SocketException: Socket is not connected
    at java.base/java.net.Socket.getOutputStream(Socket.java:1000)
    at it.auties.whatsapp.socket.SocketSession.lambda$sendBinary$3(SocketSession.java:104)
    ... 2 common frames omitted
2023-06-07 10:54:05,501 |  WARN | Thread-48495 | ErrorHandler | Ignored failure

Can you take a look at this? Thanks in advance, KR,

Auties00 commented 1 year ago

Hi @Auties00

Last few days i was running latest version (3.4.4) and got again disconnected while just be in "stand by" See below a time line and which errors are throwed

2023-06-06 01:13:23,163 | DEBUG | pool-2-thread-11 | xxx | [Whats App] Disconnect (whatsapp, reason)
2023-06-06 01:13:23,163 | DEBUG | pool-2-thread-11 | xxx | [Whats App] Disconnect reason: 'RECONNECTING'
2023-06-06 01:13:23,164 | DEBUG | pool-2-thread-11 | xxx | [Whats App] Disconnect (reason)
2023-06-06 01:13:23,164 | DEBUG | pool-2-thread-11 | xxx | [Whats App] Disconnect reason: 'RECONNECTING'
2023-06-06 01:13:23,165 | DEBUG | pool-2-thread-11 | xxx | Disconnected: RECONNECTING
2023-06-06 01:13:23,752 | ERROR | Thread-15945 | ErrorHandler | Socket failure at UNKNOWN
2023-06-06 01:13:23,752 | ERROR | Thread-15945 | xxx | WhatsApp Error: 'Cannot decrypt data using AesGMC: 068168fdbf24044db46183cd7579a75109f6f97513cefab569aa30d86c4dfa85f047158b9b4fb28da92933'
2023-06-06 01:13:23,752 | ERROR | Thread-15945 | xxx | Stacktrace: 
java.lang.RuntimeException: Cannot decrypt data using AesGMC: 068168fdbf24044db46183cd7579a75109f6f97513cefab569aa30d86c4dfa85f047158b9b4fb28da92933
  at it.auties.whatsapp.crypto.AesGmc.cipher(AesGmc.java:35)
  at it.auties.whatsapp.crypto.AesGmc.decrypt(AesGmc.java:48)
  at it.auties.whatsapp.crypto.AesGmc.decrypt(AesGmc.java:44)
  at it.auties.whatsapp.socket.SocketHandler.onMessage(SocketHandler.java:185)
  at it.auties.whatsapp.socket.SocketSession.readMessages(SocketSession.java:122)
  at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: org.bouncycastle.crypto.InvalidCipherTextException: mac check in GCM failed
  at org.bouncycastle.crypto.modes.GCMBlockCipher.doFinal(Unknown Source)
  at it.auties.whatsapp.crypto.AesGmc.cipher(AesGmc.java:32)
  ... 5 common frames omitted
2023-06-06 01:13:23,754 |  WARN | Thread-15945 | ErrorHandler | Ignored failure

However after this error, it seems like there was a successfull login afterwards

Some time later i noticed this errors several times (14 times, but each with different id's)

2023-06-07 01:06:48,130 | ERROR | Thread-47960 | ErrorHandler | Socket failure at MEDIA_CONNECTION
2023-06-07 01:06:48,131 | ERROR | Thread-47960 | xxx | WhatsApp Error: 'java.lang.RuntimeException: Node[description=iq, attributes={xmlns=w:m, to=s.whatsapp.net, id=5df563f7-ca2b-4f36-a0d0-1724458d621c, type=set}, content=[Node[description=media_conn]]] node timed out'
2023-06-07 01:06:48,131 | ERROR | Thread-47960 | xxx | Stacktrace: 
java.util.concurrent.CompletionException: java.lang.RuntimeException: Node[description=iq, attributes={xmlns=w:m, to=s.whatsapp.net, id=5df563f7-ca2b-4f36-a0d0-1724458d621c, type=set}, content=[Node[description=media_conn]]] node timed out
  at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:332)
  at java.base/java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:347)
  at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:636)
  at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510)
  at java.base/java.util.concurrent.CompletableFuture.completeExceptionally(CompletableFuture.java:2162)
  at it.auties.whatsapp.model.request.Request.cancelTimedFuture(Request.java:58)
  at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.RuntimeException: Node[description=iq, attributes={xmlns=w:m, to=s.whatsapp.net, id=5df563f7-ca2b-4f36-a0d0-1724458d621c, type=set}, content=[Node[description=media_conn]]] node timed out
  at it.auties.whatsapp.socket.SocketHandler.send(SocketHandler.java:432)
  at it.auties.whatsapp.socket.SocketHandler.send(SocketHandler.java:425)
  at it.auties.whatsapp.socket.SocketHandler.sendQuery(SocketHandler.java:421)
  at it.auties.whatsapp.socket.SocketHandler.sendQuery(SocketHandler.java:401)
  at it.auties.whatsapp.socket.StreamHandler.createMediaConnection(StreamHandler.java:853)
  at it.auties.whatsapp.socket.StreamHandler.lambda$createMediaConnection$74(StreamHandler.java:860)
  at java.base/java.util.concurrent.CompletableFuture.uniExceptionally(CompletableFuture.java:990)
  at java.base/java.util.concurrent.CompletableFuture$UniExceptionally.tryFire(CompletableFuture.java:974)
  at java.base/java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:482)
  ... 1 common frames omitted
2023-06-07 01:06:48,132 |  WARN | Thread-47960 | ErrorHandler | Ignored failure

Afterwards the connection was lost When trying to send a simple text message, i got this:

2023-06-07 10:54:05,497 | ERROR | Thread-48495 | ErrorHandler | Socket failure at MESSAGE
2023-06-07 10:54:05,498 | ERROR | Thread-48495 | xxx | WhatsApp Error: 'java.io.IOException: Cannot send Request[id=85e45b29-2ae1-43a3-9438-86f44828c54f, body=Node[description=iq, attributes={xmlns=usync, to=s.whatsapp.net, id=85e45b29-2ae1-43a3-9438-86f44828c54f, type=get}, content=[Node[description=usync, attributes={mode=query, last=true, context=message, index=0, sid=805baa60-5e79-47b9-aaed-f0e511f02f6d}, content=[Node[description=query, content=[Node[description=devices, attributes={version=2}]]], Node[description=list, content=[Node[description=user, attributes={jid=32469259740@s.whatsapp.net}], Node[description=user, attributes={jid=<jid>@s.whatsapp.net}]]]]]]], future=java.util.concurrent.CompletableFuture@56e19245[Not completed, 1 dependents], filter=null, caller=java.lang.RuntimeException: Node[description=iq, attributes={xmlns=usync, to=s.whatsapp.net, id=85e45b29-2ae1-43a3-9438-86f44828c54f, type=get}, content=[Node[description=usync, attributes={mode=query, last=true, context=message, index=0, sid=805baa60-5e79-47b9-aaed-f0e511f02f6d}, content=[Node[description=query, content=[Node[description=devices, attributes={version=2}]]], Node[description=list, content=[Node[description=user, attributes={jid=32469259740@s.whatsapp.net}], Node[description=user, attributes={jid=<jid>@s.whatsapp.net}]]]]]]] node timed out], an unknown exception occurred'
2023-06-07 10:54:05,498 | ERROR | Thread-48495 | xxx | Stacktrace: 
java.util.concurrent.CompletionException: java.io.IOException: Cannot send Request[id=85e45b29-2ae1-43a3-9438-86f44828c54f, body=Node[description=iq, attributes={xmlns=usync, to=s.whatsapp.net, id=85e45b29-2ae1-43a3-9438-86f44828c54f, type=get}, content=[Node[description=usync, attributes={mode=query, last=true, context=message, index=0, sid=805baa60-5e79-47b9-aaed-f0e511f02f6d}, content=[Node[description=query, content=[Node[description=devices, attributes={version=2}]]], Node[description=list, content=[Node[description=user, attributes={jid=32469259740@s.whatsapp.net}], Node[description=user, attributes={jid=<jid>@s.whatsapp.net}]]]]]]], future=java.util.concurrent.CompletableFuture@56e19245[Not completed, 1 dependents], filter=null, caller=java.lang.RuntimeException: Node[description=iq, attributes={xmlns=usync, to=s.whatsapp.net, id=85e45b29-2ae1-43a3-9438-86f44828c54f, type=get}, content=[Node[description=usync, attributes={mode=query, last=true, context=message, index=0, sid=805baa60-5e79-47b9-aaed-f0e511f02f6d}, content=[Node[description=query, content=[Node[description=devices, attributes={version=2}]]], Node[description=list, content=[Node[description=user, attributes={jid=32469259740@s.whatsapp.net}], Node[description=user, attributes={jid=<jid>@s.whatsapp.net}]]]]]]] node timed out], an unknown exception occurred
  at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:332)
  at java.base/java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:347)
  at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:636)
  at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510)
  at java.base/java.util.concurrent.CompletableFuture.completeExceptionally(CompletableFuture.java:2162)
  at it.auties.whatsapp.model.request.Request.onSendError(Request.java:137)
  at java.base/java.util.concurrent.CompletableFuture.uniExceptionally(CompletableFuture.java:990)
  at java.base/java.util.concurrent.CompletableFuture$UniExceptionally.tryFire(CompletableFuture.java:974)
  at java.base/java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:482)
  at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.io.IOException: Cannot send Request[id=85e45b29-2ae1-43a3-9438-86f44828c54f, body=Node[description=iq, attributes={xmlns=usync, to=s.whatsapp.net, id=85e45b29-2ae1-43a3-9438-86f44828c54f, type=get}, content=[Node[description=usync, attributes={mode=query, last=true, context=message, index=0, sid=805baa60-5e79-47b9-aaed-f0e511f02f6d}, content=[Node[description=query, content=[Node[description=devices, attributes={version=2}]]], Node[description=list, content=[Node[description=user, attributes={jid=32469259740@s.whatsapp.net}], Node[description=user, attributes={jid=<jid>@s.whatsapp.net}]]]]]]], future=java.util.concurrent.CompletableFuture@56e19245[Not completed, 1 dependents], filter=null, caller=java.lang.RuntimeException: Node[description=iq, attributes={xmlns=usync, to=s.whatsapp.net, id=85e45b29-2ae1-43a3-9438-86f44828c54f, type=get}, content=[Node[description=usync, attributes={mode=query, last=true, context=message, index=0, sid=805baa60-5e79-47b9-aaed-f0e511f02f6d}, content=[Node[description=query, content=[Node[description=devices, attributes={version=2}]]], Node[description=list, content=[Node[description=user, attributes={jid=32469259740@s.whatsapp.net}], Node[description=user, attributes={jid=<jid>@s.whatsapp.net}]]]]]]] node timed out], an unknown exception occurred
  ... 5 common frames omitted
Caused by: java.util.concurrent.CompletionException: java.io.UncheckedIOException: Cannot send message
  at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:315)
  at java.base/java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:320)
  at java.base/java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1807)
  ... 1 common frames omitted
Caused by: java.io.UncheckedIOException: Cannot send message
  at it.auties.whatsapp.socket.SocketSession.lambda$sendBinary$3(SocketSession.java:108)
  at java.base/java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1804)
  ... 1 common frames omitted
Caused by: java.net.SocketException: Socket is not connected
  at java.base/java.net.Socket.getOutputStream(Socket.java:1000)
  at it.auties.whatsapp.socket.SocketSession.lambda$sendBinary$3(SocketSession.java:104)
  ... 2 common frames omitted
2023-06-07 10:54:05,501 |  WARN | Thread-48495 | ErrorHandler | Ignored failure

Can you take a look at this? Thanks in advance, KR,

Can you try 3.4.5?

Auties00 commented 1 year ago

Also now tracking in https://github.com/Auties00/Cobalt/issues/292

GDB4J commented 1 year ago

@Auties00

Can you try 3.4.5?

I'll give it a try, but with current latest version 3.4.8

One remark already: