Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DTLS - multiple handshake at the same time #109

Closed
boaks opened this issue Mar 26, 2020 · 10 comments
Closed

DTLS - multiple handshake at the same time #109

boaks opened this issue Mar 26, 2020 · 10 comments

Comments

@boaks
Copy link

boaks commented Mar 26, 2020

Testing the coaps feature

go run examples/dtls/server/main.go

it seems, that the server is only able to handle one DTLS handshake after the other.
Is that the intended behavior?

@jkralik
Copy link
Member

jkralik commented Mar 26, 2020

Hm. As I know I didn't add such limitation. Do you know where this restriction comes from (line)?

@boaks
Copy link
Author

boaks commented Mar 26, 2020

No, I didn't check the code (though I'm not too common with "go").
I did a short interoperability test with a java implementation (Californium) and was wondering, why I could successfully handshake peer by peer, but it fails, if I start the peers to do the handshake in parallel.

@boaks
Copy link
Author

boaks commented Mar 26, 2020

Is there a way to enable some more logging for the DTLS?
Maybe that could provide the hint in the right direction.

@jkralik
Copy link
Member

jkralik commented May 27, 2020

Hi for dtls you can set logget with trace level. Like:

	loggerFactory := logging.NewDefaultLoggerFactory()
	loggerFactory.DefaultLogLevel = logging.LogLevelTrace
	dtlsCfg.LoggerFactory = loggerFactory

@jdbruijn
Copy link
Collaborator

@jkralik I've noticed the same behaviour at the latest version (v2.0.3). See the log below, with DTLS trace logs, where I've ran 5 test clients in paralell against one server. This is without using the goPool feature (related to #151), but I'm not sure whether that would change anything regarding to the DTLS handshake behaviour.

What I noticed is that the next handshake is only started after the previous one is completed. Search for the following two logs to see that behaviour.

  • conn.go:198: Handshake Completed - one handshake completed.
  • handshaker.go:147: [handshake:server] Flight 0: Preparing - start of the handshake.

I did notice that one requests seem to be handled while a next handshake is in progress. For this, see e.g. the session.go:111: Incoming message data and handler.go:21: Incoming POST /report request logs, which are from my an added log in the go-coap code and my handler and indicate a request is being handled ATM. The latter log is from my handler and is at the start of my handle function.

5 parallel clients with one server, DTLS trace logs enabled
dtls TRACE: 14:09:16.419595 handshaker.go:147: [handshake:server] Flight 0: Preparing
dtls TRACE: 14:09:16.419649 handshaker.go:147: [handshake:server] Flight 0: Sending
dtls TRACE: 14:09:16.419660 handshaker.go:147: [handshake:server] Flight 0: Waiting
dtls TRACE: 14:09:16.419735 flight0handler.go:79: [flight0Parse] -> flight2
dtls TRACE: 14:09:16.419745 handshaker.go:267: [handshake:server] Flight 0 -> Flight 2
dtls TRACE: 14:09:16.419752 handshaker.go:273: [handshake] handshakePreparing
dtls TRACE: 14:09:16.419759 handshaker.go:147: [handshake:server] Flight 2: Preparing
dtls TRACE: 14:09:16.419767 handshaker.go:147: [handshake:server] Flight 2: Sending
dtls TRACE: 14:09:16.419786 conn.go:372: [handshake:server] -> HelloVerifyRequest (epoch: 0, seq: 0)
dtls TRACE: 14:09:16.419830 handshaker.go:147: [handshake:server] Flight 2: Waiting
dtls TRACE: 14:09:16.421647 flight2handler.go:42: [flight2Parse] -> flight4
dtls TRACE: 14:09:16.421681 handshaker.go:267: [handshake:server] Flight 2 -> Flight 4
dtls TRACE: 14:09:16.421689 handshaker.go:273: [handshake] handshakePreparing
dtls TRACE: 14:09:16.421697 handshaker.go:147: [handshake:server] Flight 4: Preparing
dtls TRACE: 14:09:16.421877 handshaker.go:147: [handshake:server] Flight 4: Sending
dtls TRACE: 14:09:16.421893 conn.go:372: [handshake:server] -> ServerHello (epoch: 0, seq: 1)
dtls TRACE: 14:09:16.421906 conn.go:372: [handshake:server] -> TypeCertificate (epoch: 0, seq: 2)
dtls TRACE: 14:09:16.421915 conn.go:372: [handshake:server] -> ServerKeyExchange (epoch: 0, seq: 3)
dtls TRACE: 14:09:16.421923 conn.go:372: [handshake:server] -> CertificateRequest (epoch: 0, seq: 4)
dtls TRACE: 14:09:16.421930 conn.go:372: [handshake:server] -> ServerHelloDone (epoch: 0, seq: 5)
dtls TRACE: 14:09:16.421978 handshaker.go:147: [handshake:server] Flight 4: Waiting
dtls DEBUG: 14:09:16.434881 conn.go:722: CipherSuite not initialized, queuing packet
dtls DEBUG: 14:09:16.434928 conn.go:644: received packet of next epoch, queuing packet
dtls TRACE: 14:09:16.435013 conn.go:728: server: <- ChangeCipherSpec (epoch: 1)
dtls TRACE: 14:09:16.435032 handshaker.go:267: [handshake:server] Flight 4 -> Flight 6
dtls TRACE: 14:09:16.435039 handshaker.go:273: [handshake] handshakePreparing
dtls TRACE: 14:09:16.435044 handshaker.go:147: [handshake:server] Flight 6: Preparing
dtls TRACE: 14:09:16.435059 handshaker.go:215: [handshake:server] -> changeCipherSpec (epoch: 1)
dtls TRACE: 14:09:16.435066 handshaker.go:147: [handshake:server] Flight 6: Sending
dtls TRACE: 14:09:16.435073 conn.go:372: [handshake:server] -> Finished (epoch: 1, seq: 6)
dtls TRACE: 14:09:16.435104 handshaker.go:147: [handshake:server] Flight 6: Finished
dtls TRACE: 14:09:16.435116 conn.go:198: Handshake Completed
dtls TRACE: 14:09:16.435187 handshaker.go:147: [handshake:server] Flight 0: Preparing
dtls TRACE: 14:09:16.435207 handshaker.go:147: [handshake:server] Flight 0: Sending
dtls TRACE: 14:09:16.435213 handshaker.go:147: [handshake:server] Flight 0: Waiting
dtls TRACE: 14:09:16.435263 flight0handler.go:79: [flight0Parse] -> flight2
dtls TRACE: 14:09:16.435269 handshaker.go:267: [handshake:server] Flight 0 -> Flight 2
dtls TRACE: 14:09:16.435274 handshaker.go:273: [handshake] handshakePreparing
dtls TRACE: 14:09:16.435278 handshaker.go:147: [handshake:server] Flight 2: Preparing
dtls TRACE: 14:09:16.435283 handshaker.go:147: [handshake:server] Flight 2: Sending
dtls TRACE: 14:09:16.435289 conn.go:372: [handshake:server] -> HelloVerifyRequest (epoch: 0, seq: 0)
dtls TRACE: 14:09:16.435314 handshaker.go:147: [handshake:server] Flight 2: Waiting
dtls TRACE: 14:09:16.435504 flight2handler.go:42: [flight2Parse] -> flight4
dtls TRACE: 14:09:16.435521 handshaker.go:267: [handshake:server] Flight 2 -> Flight 4
dtls TRACE: 14:09:16.435528 handshaker.go:273: [handshake] handshakePreparing
dtls TRACE: 14:09:16.435533 handshaker.go:147: [handshake:server] Flight 4: Preparing
dtls TRACE: 14:09:16.435691 handshaker.go:147: [handshake:server] Flight 4: Sending
dtls TRACE: 14:09:16.435707 conn.go:372: [handshake:server] -> ServerHello (epoch: 0, seq: 1)
dtls TRACE: 14:09:16.435719 conn.go:372: [handshake:server] -> TypeCertificate (epoch: 0, seq: 2)
dtls TRACE: 14:09:16.435728 conn.go:372: [handshake:server] -> ServerKeyExchange (epoch: 0, seq: 3)
dtls TRACE: 14:09:16.435734 conn.go:372: [handshake:server] -> CertificateRequest (epoch: 0, seq: 4)
dtls TRACE: 14:09:16.435740 conn.go:372: [handshake:server] -> ServerHelloDone (epoch: 0, seq: 5)
dtls TRACE: 14:09:16.435777 handshaker.go:147: [handshake:server] Flight 4: Waiting
2020/08/17 14:09:16.440131 session.go:111: Incoming message data 4802624c429a3d73de2dd705b67265706f7274113ced0724286478653872793a3e5dc38bc3bdc2a5c39cc2ad0e1d2d4ec2bfc3a648c3994958220ac388c3ba53c3931fc39cc290435c6920c29777d11301d4335f33ab94ff826764656661756c74838c3a001382e819030b3a00138eb93a00137bb91a0006114319160d1a0005d9f41a000694421832001832183398181a00d5a8fb191ec61a00d307501a00d5b2bd1a0005c5b71a000292321a000568991a00374161183200183118323a000154841903ee3a00015f533a000152a418c91875183b190a9018320018321833830a18221826
2020/08/17 14:09:16.440208 handler.go:21: Incoming POST /report request from 127.0.0.1:43011
2020/08/17 14:09:16.440218 handler.go:30: Remote address '127.0.0.1' at port 43011
2020/08/17 14:09:16.440227 session.go:81: Response message data: 6000624c
dtls DEBUG: 14:09:16.442496 conn.go:722: CipherSuite not initialized, queuing packet
dtls DEBUG: 14:09:16.442536 conn.go:644: received packet of next epoch, queuing packet
dtls TRACE: 14:09:16.442616 conn.go:728: server: <- ChangeCipherSpec (epoch: 1)
dtls TRACE: 14:09:16.442634 handshaker.go:267: [handshake:server] Flight 4 -> Flight 6
dtls TRACE: 14:09:16.442640 handshaker.go:273: [handshake] handshakePreparing
dtls TRACE: 14:09:16.442645 handshaker.go:147: [handshake:server] Flight 6: Preparing
dtls TRACE: 14:09:16.442659 handshaker.go:215: [handshake:server] -> changeCipherSpec (epoch: 1)
dtls TRACE: 14:09:16.442664 handshaker.go:147: [handshake:server] Flight 6: Sending
dtls TRACE: 14:09:16.442671 conn.go:372: [handshake:server] -> Finished (epoch: 1, seq: 6)
dtls TRACE: 14:09:16.442701 handshaker.go:147: [handshake:server] Flight 6: Finished
dtls TRACE: 14:09:16.442711 conn.go:198: Handshake Completed
dtls TRACE: 14:09:16.442777 handshaker.go:147: [handshake:server] Flight 0: Preparing
dtls TRACE: 14:09:16.442788 handshaker.go:147: [handshake:server] Flight 0: Sending
dtls TRACE: 14:09:16.442793 handshaker.go:147: [handshake:server] Flight 0: Waiting
dtls TRACE: 14:09:16.442841 flight0handler.go:79: [flight0Parse] -> flight2
dtls TRACE: 14:09:16.442848 handshaker.go:267: [handshake:server] Flight 0 -> Flight 2
dtls TRACE: 14:09:16.442852 handshaker.go:273: [handshake] handshakePreparing
dtls TRACE: 14:09:16.442857 handshaker.go:147: [handshake:server] Flight 2: Preparing
dtls TRACE: 14:09:16.442861 handshaker.go:147: [handshake:server] Flight 2: Sending
dtls TRACE: 14:09:16.442866 conn.go:372: [handshake:server] -> HelloVerifyRequest (epoch: 0, seq: 0)
dtls TRACE: 14:09:16.442886 handshaker.go:147: [handshake:server] Flight 2: Waiting
2020/08/17 14:09:16.443025 session.go:111: Incoming message data 4802cb7d328ffc8132b9cfa6b67265706f7274113ced0724286478653872793a3e5dc38bc3bdc2a5c39cc2ad0e1d2d4ec2bfc3a648c3994958220ac388c3ba53c3931fc39cc290435c6920c29777d11301d4335f33ab94ff826764656661756c74838c3a001382e819030b3a00138eb93a00137bb91a0006114319160d1a0005d9f41a000694421832001832183398181a00d5a8fb191ec61a00d307501a00d5b2bd1a0005c5b71a000292321a000568991a00374161183200183118323a000154841903ee3a00015f533a000152a418c91875183b190a9018320018321833830a18221826
2020/08/17 14:09:16.443075 handler.go:21: Incoming POST /report request from 127.0.0.1:53028
2020/08/17 14:09:16.443083 handler.go:30: Remote address '127.0.0.1' at port 53028
2020/08/17 14:09:16.443090 session.go:81: Response message data: 6000cb7d
dtls TRACE: 14:09:16.443128 flight2handler.go:42: [flight2Parse] -> flight4
dtls TRACE: 14:09:16.443140 handshaker.go:267: [handshake:server] Flight 2 -> Flight 4
dtls TRACE: 14:09:16.443145 handshaker.go:273: [handshake] handshakePreparing
dtls TRACE: 14:09:16.443149 handshaker.go:147: [handshake:server] Flight 4: Preparing
dtls TRACE: 14:09:16.443281 handshaker.go:147: [handshake:server] Flight 4: Sending
dtls TRACE: 14:09:16.443293 conn.go:372: [handshake:server] -> ServerHello (epoch: 0, seq: 1)
dtls TRACE: 14:09:16.443305 conn.go:372: [handshake:server] -> TypeCertificate (epoch: 0, seq: 2)
dtls TRACE: 14:09:16.443313 conn.go:372: [handshake:server] -> ServerKeyExchange (epoch: 0, seq: 3)
dtls TRACE: 14:09:16.443320 conn.go:372: [handshake:server] -> CertificateRequest (epoch: 0, seq: 4)
dtls TRACE: 14:09:16.443325 conn.go:372: [handshake:server] -> ServerHelloDone (epoch: 0, seq: 5)
dtls TRACE: 14:09:16.443354 handshaker.go:147: [handshake:server] Flight 4: Waiting
dtls DEBUG: 14:09:16.451752 conn.go:722: CipherSuite not initialized, queuing packet
dtls DEBUG: 14:09:16.451792 conn.go:644: received packet of next epoch, queuing packet
dtls TRACE: 14:09:16.451867 conn.go:728: server: <- ChangeCipherSpec (epoch: 1)
dtls TRACE: 14:09:16.451884 handshaker.go:267: [handshake:server] Flight 4 -> Flight 6
dtls TRACE: 14:09:16.451892 handshaker.go:273: [handshake] handshakePreparing
dtls TRACE: 14:09:16.451897 handshaker.go:147: [handshake:server] Flight 6: Preparing
dtls TRACE: 14:09:16.451912 handshaker.go:215: [handshake:server] -> changeCipherSpec (epoch: 1)
dtls TRACE: 14:09:16.451917 handshaker.go:147: [handshake:server] Flight 6: Sending
dtls TRACE: 14:09:16.451923 conn.go:372: [handshake:server] -> Finished (epoch: 1, seq: 6)
dtls TRACE: 14:09:16.451955 handshaker.go:147: [handshake:server] Flight 6: Finished
dtls TRACE: 14:09:16.451966 conn.go:198: Handshake Completed
dtls TRACE: 14:09:16.452031 handshaker.go:147: [handshake:server] Flight 0: Preparing
dtls TRACE: 14:09:16.452041 handshaker.go:147: [handshake:server] Flight 0: Sending
dtls TRACE: 14:09:16.452046 handshaker.go:147: [handshake:server] Flight 0: Waiting
dtls TRACE: 14:09:16.452138 flight0handler.go:79: [flight0Parse] -> flight2
dtls TRACE: 14:09:16.452147 handshaker.go:267: [handshake:server] Flight 0 -> Flight 2
dtls TRACE: 14:09:16.452152 handshaker.go:273: [handshake] handshakePreparing
dtls TRACE: 14:09:16.452156 handshaker.go:147: [handshake:server] Flight 2: Preparing
dtls TRACE: 14:09:16.452161 handshaker.go:147: [handshake:server] Flight 2: Sending
dtls TRACE: 14:09:16.452166 conn.go:372: [handshake:server] -> HelloVerifyRequest (epoch: 0, seq: 0)
dtls TRACE: 14:09:16.452188 handshaker.go:147: [handshake:server] Flight 2: Waiting
dtls TRACE: 14:09:16.452401 flight2handler.go:42: [flight2Parse] -> flight4
dtls TRACE: 14:09:16.452416 handshaker.go:267: [handshake:server] Flight 2 -> Flight 4
dtls TRACE: 14:09:16.452422 handshaker.go:273: [handshake] handshakePreparing
dtls TRACE: 14:09:16.452427 handshaker.go:147: [handshake:server] Flight 4: Preparing
dtls TRACE: 14:09:16.452566 handshaker.go:147: [handshake:server] Flight 4: Sending
dtls TRACE: 14:09:16.452576 conn.go:372: [handshake:server] -> ServerHello (epoch: 0, seq: 1)
dtls TRACE: 14:09:16.452587 conn.go:372: [handshake:server] -> TypeCertificate (epoch: 0, seq: 2)
dtls TRACE: 14:09:16.452594 conn.go:372: [handshake:server] -> ServerKeyExchange (epoch: 0, seq: 3)
dtls TRACE: 14:09:16.452600 conn.go:372: [handshake:server] -> CertificateRequest (epoch: 0, seq: 4)
dtls TRACE: 14:09:16.452605 conn.go:372: [handshake:server] -> ServerHelloDone (epoch: 0, seq: 5)
dtls TRACE: 14:09:16.452639 handshaker.go:147: [handshake:server] Flight 4: Waiting
2020/08/17 14:09:16.453259 session.go:111: Incoming message data 4802df1696a66b6d6f24c810b67265706f7274113ced0724286478653872793a3e5dc38bc3bdc2a5c39cc2ad0e1d2d4ec2bfc3a648c3994958220ac388c3ba53c3931fc39cc290435c6920c29777d11301d4335f33ab94ff826764656661756c74838c3a001382e819030b3a00138eb93a00137bb91a0006114319160d1a0005d9f41a000694421832001832183398181a00d5a8fb191ec61a00d307501a00d5b2bd1a0005c5b71a000292321a000568991a00374161183200183118323a000154841903ee3a00015f533a000152a418c91875183b190a9018320018321833830a18221826
2020/08/17 14:09:16.453332 handler.go:21: Incoming POST /report request from 127.0.0.1:56459
2020/08/17 14:09:16.453344 handler.go:30: Remote address '127.0.0.1' at port 56459
2020/08/17 14:09:16.453353 session.go:81: Response message data: 6000df16
dtls DEBUG: 14:09:16.461357 conn.go:722: CipherSuite not initialized, queuing packet
dtls DEBUG: 14:09:16.461402 conn.go:644: received packet of next epoch, queuing packet
dtls TRACE: 14:09:16.461476 conn.go:728: server: <- ChangeCipherSpec (epoch: 1)
dtls TRACE: 14:09:16.461491 handshaker.go:267: [handshake:server] Flight 4 -> Flight 6
dtls TRACE: 14:09:16.461496 handshaker.go:273: [handshake] handshakePreparing
dtls TRACE: 14:09:16.461501 handshaker.go:147: [handshake:server] Flight 6: Preparing
dtls TRACE: 14:09:16.461523 handshaker.go:215: [handshake:server] -> changeCipherSpec (epoch: 1)
dtls TRACE: 14:09:16.461528 handshaker.go:147: [handshake:server] Flight 6: Sending
dtls TRACE: 14:09:16.461534 conn.go:372: [handshake:server] -> Finished (epoch: 1, seq: 6)
dtls TRACE: 14:09:16.461562 handshaker.go:147: [handshake:server] Flight 6: Finished
dtls TRACE: 14:09:16.461571 conn.go:198: Handshake Completed
dtls TRACE: 14:09:16.461635 handshaker.go:147: [handshake:server] Flight 0: Preparing
dtls TRACE: 14:09:16.461645 handshaker.go:147: [handshake:server] Flight 0: Sending
dtls TRACE: 14:09:16.461649 handshaker.go:147: [handshake:server] Flight 0: Waiting
dtls TRACE: 14:09:16.461692 flight0handler.go:79: [flight0Parse] -> flight2
dtls TRACE: 14:09:16.461697 handshaker.go:267: [handshake:server] Flight 0 -> Flight 2
dtls TRACE: 14:09:16.461701 handshaker.go:273: [handshake] handshakePreparing
dtls TRACE: 14:09:16.461705 handshaker.go:147: [handshake:server] Flight 2: Preparing
dtls TRACE: 14:09:16.461710 handshaker.go:147: [handshake:server] Flight 2: Sending
dtls TRACE: 14:09:16.461715 conn.go:372: [handshake:server] -> HelloVerifyRequest (epoch: 0, seq: 0)
dtls TRACE: 14:09:16.461734 handshaker.go:147: [handshake:server] Flight 2: Waiting
dtls TRACE: 14:09:16.462110 flight2handler.go:42: [flight2Parse] -> flight4
dtls TRACE: 14:09:16.462125 handshaker.go:267: [handshake:server] Flight 2 -> Flight 4
dtls TRACE: 14:09:16.462130 handshaker.go:273: [handshake] handshakePreparing
dtls TRACE: 14:09:16.462135 handshaker.go:147: [handshake:server] Flight 4: Preparing
dtls TRACE: 14:09:16.462271 handshaker.go:147: [handshake:server] Flight 4: Sending
dtls TRACE: 14:09:16.462282 conn.go:372: [handshake:server] -> ServerHello (epoch: 0, seq: 1)
dtls TRACE: 14:09:16.462289 conn.go:372: [handshake:server] -> TypeCertificate (epoch: 0, seq: 2)
dtls TRACE: 14:09:16.462298 conn.go:372: [handshake:server] -> ServerKeyExchange (epoch: 0, seq: 3)
dtls TRACE: 14:09:16.462304 conn.go:372: [handshake:server] -> CertificateRequest (epoch: 0, seq: 4)
dtls TRACE: 14:09:16.462309 conn.go:372: [handshake:server] -> ServerHelloDone (epoch: 0, seq: 5)
dtls TRACE: 14:09:16.462340 handshaker.go:147: [handshake:server] Flight 4: Waiting
2020/08/17 14:09:16.466963 session.go:111: Incoming message data 4802459c80897ab2e5b7cf3eb67265706f7274113ced0724286478653872793a3e5dc38bc3bdc2a5c39cc2ad0e1d2d4ec2bfc3a648c3994958220ac388c3ba53c3931fc39cc290435c6920c29777d11301d4335f33ab94ff826764656661756c74838c3a001382e819030b3a00138eb93a00137bb91a0006114319160d1a0005d9f41a000694421832001832183398181a00d5a8fb191ec61a00d307501a00d5b2bd1a0005c5b71a000292321a000568991a00374161183200183118323a000154841903ee3a00015f533a000152a418c91875183b190a9018320018321833830a18221826
2020/08/17 14:09:16.467040 handler.go:21: Incoming POST /report request from 127.0.0.1:45144
2020/08/17 14:09:16.467053 handler.go:30: Remote address '127.0.0.1' at port 45144
2020/08/17 14:09:16.467065 session.go:81: Response message data: 6000459c
dtls DEBUG: 14:09:16.470029 conn.go:722: CipherSuite not initialized, queuing packet
dtls DEBUG: 14:09:16.470081 conn.go:644: received packet of next epoch, queuing packet
dtls TRACE: 14:09:16.470166 conn.go:728: server: <- ChangeCipherSpec (epoch: 1)
dtls TRACE: 14:09:16.470183 handshaker.go:267: [handshake:server] Flight 4 -> Flight 6
dtls TRACE: 14:09:16.470190 handshaker.go:273: [handshake] handshakePreparing
dtls TRACE: 14:09:16.470195 handshaker.go:147: [handshake:server] Flight 6: Preparing
dtls TRACE: 14:09:16.470210 handshaker.go:215: [handshake:server] -> changeCipherSpec (epoch: 1)
dtls TRACE: 14:09:16.470216 handshaker.go:147: [handshake:server] Flight 6: Sending
dtls TRACE: 14:09:16.470223 conn.go:372: [handshake:server] -> Finished (epoch: 1, seq: 6)
dtls TRACE: 14:09:16.470256 handshaker.go:147: [handshake:server] Flight 6: Finished
dtls TRACE: 14:09:16.470266 conn.go:198: Handshake Completed
2020/08/17 14:09:16.470726 session.go:111: Incoming message data 4802323336bd9b04c8207c1eb67265706f7274113ced0724286478653872793a3e5dc38bc3bdc2a5c39cc2ad0e1d2d4ec2bfc3a648c3994958220ac388c3ba53c3931fc39cc290435c6920c29777d11301d4335f33ab94ff826764656661756c74838c3a001382e819030b3a00138eb93a00137bb91a0006114319160d1a0005d9f41a000694421832001832183398181a00d5a8fb191ec61a00d307501a00d5b2bd1a0005c5b71a000292321a000568991a00374161183200183118323a000154841903ee3a00015f533a000152a418c91875183b190a9018320018321833830a18221826
2020/08/17 14:09:16.470796 handler.go:21: Incoming POST /report request from 127.0.0.1:48948
2020/08/17 14:09:16.470806 handler.go:30: Remote address '127.0.0.1' at port 48948
2020/08/17 14:09:16.470814 session.go:81: Response message data: 60003233

@jdbruijn
Copy link
Collaborator

I've created my own DTLSListener to workaround this issue for the time being. In this I just create a whole bunch of goroutines for the amount of handshakes I want to handle concurrently.

Attached is this workaround, which uses 1000 goroutines. @boaks maybe this will help you as well for the time being.

dtls-listener.zip

@boaks
Copy link
Author

boaks commented Aug 22, 2020

I'm not common enough to go to get that patch running.
Would it be possible to get some instructions?

@jdbruijn
Copy link
Collaborator

@boaks Yeah, just copy the file somewhere in your sources. Then, instead of calling coap.ListenAndServeDTLS you now call the StartDTLSListener function. I'm using a couple of extra arguments, like expiration but you can remove those if you don't need them. By calling StartDTLSListener, you use the DTLS listener from the attached file and thus use the listeners in N goroutines.

@boaks
Copy link
Author

boaks commented Aug 30, 2020

Thanks!
With the dtls-listener I'm able to execute dtls handshakes in parallel.

@boaks boaks closed this as completed Aug 30, 2020
@niondir
Copy link
Collaborator

niondir commented Dec 20, 2021

We also face this issue. From taking a look at the code, I would spawn the go routine after the accept and not hard limit the number of routines to 1.000. Anyway we probably can share the code if we find more scalable solution :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants