1

I have implemented a socket - client interaction using akka's TCP module. I am trying to make the application to detect when the socket is closed and release the resources assigned to that client's socket.

Akka has case _ : ConnectionClosed case in order to handle this kind of situation.But i have realized that it is not being called when the internet connection is down.

I couldn't be able to find anything to detect that the socket's client part is disconnected from the internet.

Is there any specifics that I am missing?

tshepang
  • 12,111
  • 21
  • 91
  • 136
Suat KARAKUSOGLU
  • 622
  • 6
  • 14

1 Answers1

0

The network connection going down doesn't necessarily close any sockets, the OS is free to leave them open in case the network connection recovers. I believe this is really an issue with your OS, and not with Akka. TCP connections will eventually timeout, but this can take tens of minutes. See TCP Socket no connection timeout.

Community
  • 1
  • 1
wingedsubmariner
  • 13,350
  • 1
  • 27
  • 52
  • 1
    Now i see that was the main problem. I haven't thought that it would be 2 hours for a connection to drop. Solution for me was changing the OS parameters "echo 60 > /proc/sys/net/ipv4/tcp_keepalive_time","echo 5 > /proc/sys/net/ipv4/tcp_keepalive_intvl ","echo 3 > /proc/sys/net/ipv4/tcp_keepalive_probes" – Suat KARAKUSOGLU Apr 25 '14 at 09:32