You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@pekko.apache.org by "He-Pin (via GitHub)" <gi...@apache.org> on 2023/08/08 09:30:13 UTC

[GitHub] [incubator-pekko] He-Pin opened a new pull request, #549: =sbt Do retry connection in Player.

He-Pin opened a new pull request, #549:
URL: https://github.com/apache/incubator-pekko/pull/549

   refs: https://github.com/apache/incubator-pekko/issues/547
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


[GitHub] [incubator-pekko] He-Pin commented on pull request #549: =sbt Do retry connection in Player.

Posted by "He-Pin (via GitHub)" <gi...@apache.org>.
He-Pin commented on PR #549:
URL: https://github.com/apache/incubator-pekko/pull/549#issuecomment-1669323537

   ```scala
   [info] [JVM-2-MultiDcLastNodeMultiJvmNode2] [ERROR] [08/08/2023 10:05:01.021] [MultiDcLastNode-pekko.actor.default-dispatcher-6] [PlayerHandler(pekko://MultiDcLastNode)] Error when try to connect to remote addr:[localhost/127.0.0.1:4711] will retry, time left:[-4301592 nanoseconds], cause:[Connection refused: localhost/127.0.0.1:4711].
   [info] [JVM-2-MultiDcLastNodeMultiJvmNode2] [ERROR] [08/08/2023 10:05:01.048] [MultiDcLastNode-pekko.actor.default-dispatcher-18] [PlayerHandler(pekko://MultiDcLastNode)] Error when try to connect to remote addr:[localhost/127.0.0.1:4711] will retry, time left:[980216623 nanoseconds], cause:[Connection refused: localhost/127.0.0.1:4711].
   ```
   
   I tested it on my box, works as expected.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


[GitHub] [incubator-pekko] He-Pin commented on a diff in pull request #549: =sbt Do retry connection in Player.

Posted by "He-Pin (via GitHub)" <gi...@apache.org>.
He-Pin commented on code in PR #549:
URL: https://github.com/apache/incubator-pekko/pull/549#discussion_r1286880330


##########
multi-node-testkit/src/main/scala/org/apache/pekko/remote/testconductor/Player.scala:
##########
@@ -338,21 +340,36 @@ private[pekko] class PlayerHandler(
 
   import ClientFSM._
 
-  val connectionRef: AtomicReference[RemoteConnection] = new AtomicReference[RemoteConnection](reconnect())
+  val connectionRef: AtomicReference[RemoteConnection] = new AtomicReference[RemoteConnection]()
 
   var nextAttempt: Deadline = _
 
+  tryConnectToController()
+
   @nowarn("msg=deprecated")
   override def exceptionCaught(ctx: ChannelHandlerContext, cause: Throwable): Unit = {
     log.error("channel {} exception {}", ctx.channel(), cause)
     cause match {
       case _: ConnectException if reconnects > 0 =>
         reconnects -= 1
-        scheduler.scheduleOnce(nextAttempt.timeLeft)(connectionRef.set(reconnect()))
       case e => fsm ! ConnectionFailure(e.getMessage)
     }
   }
 
+  private def tryConnectToController(): Unit = {
+    Try(reconnect()) match {
+      case Success(r) => connectionRef.set(r)
+      case Failure(ex) =>

Review Comment:
   `reconnect-backoff = 1s` which is used in the `reconnect()`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


[GitHub] [incubator-pekko] He-Pin merged pull request #549: =sbt Do retry connection in Player.

Posted by "He-Pin (via GitHub)" <gi...@apache.org>.
He-Pin merged PR #549:
URL: https://github.com/apache/incubator-pekko/pull/549


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


[GitHub] [incubator-pekko] mdedetrich commented on a diff in pull request #549: =sbt Do retry connection in Player.

Posted by "mdedetrich (via GitHub)" <gi...@apache.org>.
mdedetrich commented on code in PR #549:
URL: https://github.com/apache/incubator-pekko/pull/549#discussion_r1286869433


##########
multi-node-testkit/src/main/scala/org/apache/pekko/remote/testconductor/Player.scala:
##########
@@ -338,21 +340,36 @@ private[pekko] class PlayerHandler(
 
   import ClientFSM._
 
-  val connectionRef: AtomicReference[RemoteConnection] = new AtomicReference[RemoteConnection](reconnect())
+  val connectionRef: AtomicReference[RemoteConnection] = new AtomicReference[RemoteConnection]()
 
   var nextAttempt: Deadline = _
 
+  tryConnectToController()
+
   @nowarn("msg=deprecated")
   override def exceptionCaught(ctx: ChannelHandlerContext, cause: Throwable): Unit = {
     log.error("channel {} exception {}", ctx.channel(), cause)
     cause match {
       case _: ConnectException if reconnects > 0 =>
         reconnects -= 1
-        scheduler.scheduleOnce(nextAttempt.timeLeft)(connectionRef.set(reconnect()))
       case e => fsm ! ConnectionFailure(e.getMessage)
     }
   }
 
+  private def tryConnectToController(): Unit = {
+    Try(reconnect()) match {
+      case Success(r) => connectionRef.set(r)
+      case Failure(ex) =>

Review Comment:
   Is it worth it to use exponential backoff here or is that excessive?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org