question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Slow timeout when trying to connect to an invalid IP address

See original GitHub issue

From #615

python -m pynetdicom echoscu [invalid IP] 11112 -d -ta 5

Should immediately fail due to non-existent IP, but doesn’t.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
scaramallioncommented, May 12, 2021

Fixed with #618

0reactions
scaramallioncommented, Apr 29, 2021

After writing all the below, the simplest simplest way is to probably just put None on DUL.to_user_queue when the connection fails so the blocking rsp = self.dul.receive_pdu(...) returns. Maybe see if there’s a way to get a better log message in that case.


The state machine for the start of association requests is

Sta1 + Evt1 -> AE-1 -> Sta4
Sta4 + Evt2 -> AE-2 -> Sta5

Where

Sta1: Idle
Sta4: Awaiting transport connection opening to complete (from local transport service)
Sta5: Awaiting A-ASSOCIATE-AC or A-ASSOCIATE-RJ PDU

Evt1: A-ASSOCIATE request received from local user)
Evt2: Transport connection confirmation from local transport service

So while we’re operating in Sta4, the ACSE timeout should be idle until Evt2 occurs and we reach Sta5. There seems to be a step missing in _negotiate_as_requestor() after sending the A-ASSOCIATE request primitive to the DUL in send_request() and prior to rsp = self.dul.receive_pdu(wait=True, timeout=self.acse_timeout) where we wait until the connection has been made.

I’d be inclined to put in a timeout check (based on network_timeout?) in between that waits on Sta5.

self.send_request()

while self.assoc.dul.state_machine.state != 'Sta5':
    # wait until timeout expires

evt.trigger(self.assoc, evt.EVT_REQUESTED, {})

It’s probably better to use a threading event there with the other end tied to the socket.connect() code so the ACSE only containues once the connection request is made or failed.

Alternatively you could just lock the thread into the socket.connect() code until timeout… but that might have weird effects when running an AE with multiple SCPs that needs to make association requests.

I really hate threading…

Read more comments on GitHub >

github_iconTop Results From Across the Web

[SOLVED] How to Fix the ERR_CONNECTION_TIMED_OUT ...
Ways to Fix Err_Connection_Timed_Out Error · Method 1: Try VPN · Method 2: Flush DNS Cache · Method 3: Check Your Connection ·...
Read more >
How to Fix the ERR_CONNECTION_TIMED_OUT Error - Kinsta
1. Check Your Connection · Restart your home or office router. This only takes a few minutes and solves more problems than a...
Read more >
What Does a Server Connection Timeout Mean?
A server connection timeout means that a server is taking too long to reply to a data request made from another device. Timeouts...
Read more >
Why am I getting a connection timeout error with ssh?
Whenever I try to ssh to a public ip address from my windows 10 computer, I get an error that looks like ssh:...
Read more >
Why is a Website 'Taking Too Long to Respond' & How to Fix
The error is usually sent if the client cannot get a response within 30 seconds. The connection attempt is then terminated.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found