Lazarus

Programming => General => Topic started by: peardox on January 15, 2020, 04:35:10 pm

Title: Synapse Ping bad responses
Post by: peardox on January 15, 2020, 04:35:10 pm
My Internet is playing up so I decided to write a quick little utility to record Internet outages

I cribbed the basics from https://forum.lazarus.freepascal.org/index.php?topic=39409.0 - the quick little app uses that at its heart on a timer.

After some issues getting Synapse to (not) install I just dumped the entire source tree in my project - well, at least it works this way...

Anyway, I've gone through several iterations of the app in the last day. It seems a little "sensitive" - that or my Internet is really bad.

I've got it running on a 1 second timer pinging 1.1.1.1 which usually does a 15 ms ping. The ping has a 750ms timeout setting so everything should be completed within the second.

If a ping results in a timeout I count it as a bad ping, if the ping fails for 10 secs I call it a disconnect.

The current run has been going for about 7.5 hours and I've recorded 873 failed pings (out of c 26,800 total) with 11 cases lasting > 10 seconds (142 secs for the 11 triggers)

As I see it there are two possible issues...

1) My Internet is really crap
2) The timer is being re-entered before the last one finished (I'll try checking that later)

Anyone got any bright ideas?

Title: Re: Synapse Ping bad responses
Post by: lucamar on January 15, 2020, 04:51:56 pm
Anyone got any bright ideas?

One question comes to mind: are you sure the server is not just locking you out? Pinging a server continuousy might be considered a DoS trial attack. Just saying :-X
Title: Re: Synapse Ping bad responses
Post by: peardox on January 15, 2020, 05:04:18 pm
I chose 1.1.1.1 specifically for that reason - it's CloudFlare's DNS

https://en.wikipedia.org/wiki/1.1.1.1
Title: Re: Synapse Ping bad responses
Post by: MarkMLl on January 15, 2020, 05:09:53 pm
Speaking as somebody who has spent far too much time messing around with this sort of thing: what results do you get if you run ping from a shell with the equivalent parameters?

Is the far end somebody with whom you have any sort of commercial relationship? If not then they're be entirely justified in ignoring you if they've got better use for their bandwidth.

MarkMLl
Title: Re: Synapse Ping bad responses
Post by: MarkMLl on January 15, 2020, 05:11:52 pm
I chose 1.1.1.1 specifically for that reason - it's CloudFlare's DNS

Have they explicitly said that they don't mind people pinging it? Just because somebody's putting up one particular service doesn't mean they accept a different one: one of the ISPs we use has a dedicated server for pings which also captures various metrics.

MarkMLl
Title: Re: Synapse Ping bad responses
Post by: peardox on January 15, 2020, 05:38:33 pm
I don't see CloudFlare having any issues with me pinging them once a second, in fact the same should hold true for ny number of open systems e.g. Google DNS, OpenDNS etc

Pinging a server ain't a DDos, in fact CloudFlare claim to be able to adapt to DDos attacks which is why I specifically chose that server

Just to rule any ownership issues out I'm now pinging my AWS server - I give myself permission to do so...:)

Title: Re: Synapse Ping bad responses
Post by: Thaddy on January 15, 2020, 06:12:15 pm
On - some of - my servers I drop ping requests. I suppose CloudFlare does the same.

And, btw, ping flooding is a ddos attack! So many well behaved servers ignore ping requests. So ignore that response.

Instead of sending to /dev/null, the latter can also be mitigated by timed response based on single connection registration that allows only a finite amount of pings from the same IP. That's probably what happens here. Try 500 ms instead of 15 ms. Your 750 in between seems ok to me.
Title: Re: Synapse Ping bad responses
Post by: winni on January 15, 2020, 06:17:18 pm
Hi!

Open a terminal and ping your favourite address.
Do the same with your own synapse app.

Now you can compare the two response times.

Afterwards you know, if you got a lousy provider or if the problem is synapse-based.

Winni
Title: Re: Synapse Ping bad responses
Post by: Thaddy on January 15, 2020, 06:22:35 pm
Hi!

Open a terminal and ping your favourite address.
Do the same with your own synapse app.
Good idea. I bet that they behave the same (exactly the same). Note the ping utilities on all platforms have a much larger time value than 15 ms in between pings (about 250 ms).
Quote
Now you can compare the two response times.

Afterwards you know, if you got a lousy provider or if the problem is synapse-based.
That is nonsense, as I explained. It is controlled server side.
Title: Re: Synapse Ping bad responses
Post by: winni on January 15, 2020, 06:29:06 pm
God knows everything.
Thaddy knows everything better.

There  are enough public servers which don't drop pings - 1.1.1.1 is one of them.
Another bullet proof server is  104.18.55.162 (https://sportzonline.to).

Winni
Title: Re: Synapse Ping bad responses
Post by: Thaddy on January 15, 2020, 06:31:18 pm
@winni
There are just as many servers that drop pings by any of the means I described.
I supposed he pings a particular server over which he does not have control.
Title: Re: Synapse Ping bad responses
Post by: peardox on January 15, 2020, 06:31:55 pm
1) Cloudflare have an article on ping flood - https://www.cloudflare.com/learning/ddos/ping-icmp-flood-ddos-attack/

I'm not doing anything that could be interpreted as such...

Think I'll email CloudFlare and ask them where best to ping, the app is useful and I couldn't find a free one that did even close what I want.

2) Did the comparison on a local Linux box

Got similar results for timeouts (one extra for my app)

Interestingly the Linux ping reported zero losses as it found the ones that got missed - they took > 1s by the look of it to Google + back. The 571/572 bit will be me killing the ping...

simon@Ubu:~/git/utils/mtg/Logs$ ping -O -q 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
no answer yet for icmp_seq=4
no answer yet for icmp_seq=486
^C
--- 8.8.8.8 ping statistics ---
572 packets transmitted, 571 received, 0% packet loss, time 571943ms
rtt min/avg/max/mdev = 11.473/16.813/1027.469/43.493 ms, pipe 2

3) Guess I need to read the Synapse docs to see if there's an event or something for pings that take a long time...
Title: Re: Synapse Ping bad responses
Post by: Thaddy on January 15, 2020, 06:34:31 pm
3) Guess I need to read the Synapse docs to see if there's an event or something for pings that take a long time...
That's easy. The time out is set on the socket. Will add link later.
Title: Re: Synapse Ping bad responses
Post by: peardox on January 15, 2020, 06:35:43 pm
God knows everything.
Thaddy knows everything better.

There  are enough public servers which don't drop pings - 1.1.1.1 is one of them.
Another bullet proof server is  104.18.55.162 (https://sportzonline.to).

Winni

Yeah, switching from 1.1.1.1 to my own server had precisely one effect... The ping times went from 15ms to 90+ms :(

Changing back to a nice fast one...

Title: Re: Synapse Ping bad responses
Post by: Thaddy on January 15, 2020, 06:37:00 pm
Synapse time out link: http://synapse.ararat.cz/doc/help/ and click class Tblocksocket, scroll down.
(Note I have a public server dedicated to check internet connection and client IP: http://ip.thaddy.com That server has been up since 2004 apart from planned maintenance. It returns a static string)
Title: Re: Synapse Ping bad responses
Post by: winni on January 15, 2020, 06:41:52 pm
@winni
There are just as many servers that drop pings by any of the means I described.
I supposed he pings a particular server over which he does not have control.

I dont't know if the Dutch have a ping allergy.

From Northern Germany a dropped ping is a very rare event.
I only remember one example: The german Spiegel magazine had disabled the ping some years ago.
That's all.

Winni
Title: Re: Synapse Ping bad responses
Post by: MarkMLl on January 15, 2020, 06:48:22 pm
From Northern Germany a dropped ping is a very rare event.
I only remember one example: The german Spiegel magazine had disabled the ping some years ago.

I've seen plenty. Just because somebody is prepared to expose HTTP or DNS doesn't mean they're prepared to respond to pings, and very often if you use Traceroute you can only get to one hop away from the actual server.

MarkMLl
Title: Re: Synapse Ping bad responses
Post by: Thaddy on January 15, 2020, 06:49:36 pm
Correct. Also: try some German banks... O:-) Not particularly the portal but a known subdomain...

[edit] funny test:
my.vodafone.nl // drops pings. Applause,
my.vodafone.de // does NOT drop pings...  :D :D

binckbank.nl // drops pings because I said so...based on government provided best practice.
Title: Re: Synapse Ping bad responses
Post by: peardox on January 15, 2020, 06:53:19 pm
A related observation...

I copied the app over to my Mac - that one didn't ping at all, odd.

Not looked into it properly - just compiled and it didn't ping. Synapse don't explicitly say it supports OSX but most things work equally well on Win/Mac/Linux

When I've tidied it up I'dd also try it on my Linux box, Raspberry Pi etc
Title: Re: Synapse Ping bad responses
Post by: MarkMLl on January 15, 2020, 07:39:12 pm
I copied the app over to my Mac - that one didn't ping at all, odd.

User capabilities. Sending ping generally needs capabilities that an unprivileged user doesn't have, and Synapse might be able to work round that on one OS but not on another (e.g. on Linux ping and ping6 are generally either setuid root or have had extra capabilities granted them: see setcap and getcap, and a thread from a week or so ago).

MarkMLl
TinyPortal © 2005-2018