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

ZMap fails to terminate #809

Closed
dbomma opened this issue Mar 5, 2024 · 8 comments · Fixed by #811
Closed

ZMap fails to terminate #809

dbomma opened this issue Mar 5, 2024 · 8 comments · Fixed by #811
Assignees
Labels
Milestone

Comments

@dbomma
Copy link

dbomma commented Mar 5, 2024

Describe the bug
ZMap fails to terminate after reaching 100%. It continues to print logs, but fails to terminate or increment the "done" count.

CLI Arguments

echo '0.0.0.0' | xargs sudo zmap --sender-threads=200 -p 80

Example Target IP
0.0.0.0
I am attempting to perform a full /0 scan.

Expected behavior
I expect ZMap to terminate after printing "100%".

Environment:

  • OS: Ubuntu 22.04.4 LTS
  • Version: GitHub HEAD

Additional context
Here is a sample of the logs from Zmap:

2:13:46 106% (136 years left); send: 3702258432 done (489 Kp/s avg); recv: 22297 0 p/s (2 p/s avg); drops: 0 p/s (135 p/s avg); hitrate: 0.00%
2:13:47 106% (136 years left); send: 3702258432 done (489 Kp/s avg); recv: 22297 0 p/s (2 p/s avg); drops: 0 p/s (135 p/s avg); hitrate: 0.00%
2:13:48 106% (136 years left); send: 3702258432 done (489 Kp/s avg); recv: 22297 0 p/s (2 p/s avg); drops: 0 p/s (135 p/s avg); hitrate: 0.00%
2:13:49 106% (136 years left); send: 3702258432 done (489 Kp/s avg); recv: 22297 0 p/s (2 p/s avg); drops: 0 p/s (135 p/s avg); hitrate: 0.00%
2:13:50 106% (136 years left); send: 3702258432 done (489 Kp/s avg); recv: 22297 0 p/s (2 p/s avg); drops: 0 p/s (135 p/s avg); hitrate: 0.00%
2:13:51 106% (136 years left); send: 3702258432 done (489 Kp/s avg); recv: 22297 0 p/s (2 p/s avg); drops: 0 p/s (135 p/s avg); hitrate: 0.00%

The percent is over 100%, but the amount of packets sent is also not increasing.

@dbomma dbomma added the bug label Mar 5, 2024
@phillip-stephens
Copy link
Contributor

When I try to reproduce with the latest main on Ubuntu, I'm not getting the same output with your CLI arguments. Can you post a screen recording?

$ echo '0.0.0.0' | xargs sudo ./src/zmap --sender-threads=200 -p 80
Mar 05 22:32:09.563 [INFO] zmap: By default, ZMap will output the unique IP addresses of hosts that respond successfully (e.g., SYN-ACK packet). This is equivalent to running ZMap with the following flags: --output-module=csv --output-fields=saddr --output-filter='success=1 && repeat=0' --no-header-row. If you want all responses, explicitly set an output module or set --output-filter="".
Mar 05 22:32:09.563 [INFO] dedup: Response deduplication method is full
Mar 05 22:32:09.567 [ERROR] blocklist: no addresses are eligible to be scanned in the current configuration. This may be because the blocklist being used by ZMap ((null)) prevents any addresses from receiving probe packets.
Mar 05 22:32:09.567 [FATAL] zmap: unable to initialize blocklist / allowlist

@phillip-stephens
Copy link
Contributor

phillip-stephens commented Mar 5, 2024

Besides that however, using --sender-threads=200 is likely going to be problematic.The sending threads can send as fast as possible and that many threads is going to cause resource contention. There's no performance benefit to having # of threads > available cores.

@dbomma
Copy link
Author

dbomma commented Mar 5, 2024

When I try to reproduce with the latest main on Ubuntu, I'm not getting the same output with your CLI arguments. Can you post a screen recording?

$ echo '0.0.0.0' | xargs sudo ./src/zmap --sender-threads=200 -p 80
Mar 05 22:32:09.563 [INFO] zmap: By default, ZMap will output the unique IP addresses of hosts that respond successfully (e.g., SYN-ACK packet). This is equivalent to running ZMap with the following flags: --output-module=csv --output-fields=saddr --output-filter='success=1 && repeat=0' --no-header-row. If you want all responses, explicitly set an output module or set --output-filter="".
Mar 05 22:32:09.563 [INFO] dedup: Response deduplication method is full
Mar 05 22:32:09.567 [ERROR] blocklist: no addresses are eligible to be scanned in the current configuration. This may be because the blocklist being used by ZMap ((null)) prevents any addresses from receiving probe packets.
Mar 05 22:32:09.567 [FATAL] zmap: unable to initialize blocklist / allowlist

Ah, sorry about that, missed the /0. correct command is

echo '0.0.0.0/0' | xargs sudo zmap --sender-threads=200 -p 80

@dbomma
Copy link
Author

dbomma commented Mar 5, 2024

Besides that however, using --sender-threads=200 is likely going to be problematic.The sending threads can send as fast as possible and that many threads is going to cause resource contention. There's no performance benefit to having # of threads > available cores.

That makes sense, I'll try toning it down a notch and seeing if that resolves the issue on its own.

@phillip-stephens phillip-stephens linked a pull request Mar 6, 2024 that will close this issue
@zakird
Copy link
Member

zakird commented Mar 7, 2024

@phillip-stephens even though a large number of threads shouldn't be used, it does seem like there's a bug here. ZMap should still terminate in this situation and it shouldn't reach above 100%...

@zakird zakird added this to the ZMap 4.1 milestone Mar 7, 2024
@phillip-stephens
Copy link
Contributor

This was closed automatically because when the PR was merged it closed the associated issue. Re-opening to investigate the non-termination.

My initial guess is that there's such strong resource contention that the threads can't make progress (or at least in a reasonable timeframe). Tho I don't have a guess for the >100% completion 🤔

@zakird
Copy link
Member

zakird commented Mar 7, 2024 via email

@phillip-stephens
Copy link
Contributor

I'm thinking this has two components:

  1. Fails to terminate
    a) Potentially fixed in Do not skip elements >= (1 << 48) w/o checking for sentinel #814
  2. Percentage complete is over 100%
    a) Fixed in Capped percent complete in monitor.c #825

I'm going to close this since I was unable to reproduce post #814 and we can reopen if this resurfaces!

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

Successfully merging a pull request may close this issue.

3 participants