View Issue Details

IDProjectCategoryView StatusLast Update
0007029GNUnetDHT servicepublic2022-02-26 22:10
Reportermd Assigned ToChristian Grothoff Due Date
PrioritynormalSeveritycrashReproducibilitysometimes
Status closedResolutionreopened 
PlatformGNU/LinuxOSGuix SystemOS Versionv???
Product Version0.13.1 
Target Version0.16.0Fixed in Version0.16.0 
Summary0007029: Assertion failure in get_target_peers (when allocating rtargets)
DescriptionWhen testing the "http://localhost:8089/search-dht" form of Scheme-GNUnet,
 gnunet-service-dht crashed with the following message:

okt 05 20:07:27-878394 dht-25189 ERROR Assertion failed at gnunet-service-dht_neighbours.c:1181. Aborting.

Looking at gnunet-service-dht_neighbours.c:1181, that's

  rtargets = GNUNET_new_array (ret,
                               struct PeerInfo *);

so maybe 'ret' was to large? 'ret' is assigned by:

  ret = get_forward_count (hop_count,
                           target_replication);

so maybe get_forward_count returns a too large result?

Curiously, the crash only happens if the replication level is zero, and not if it is one.
Also note that that the network size (according to $GNUB/gnunet-nse) is 1:
1633458666879901 1,000000 0,000000 -nan

and ‘target_value’ is:

  target_value =
    1 + (target_replication - 1.0) / (GDS_NSE_get ()
                                      + ((float) (target_replication - 1.0)
                                         * hop_count));

So for target_replication=0, target_value = 1 - 1/(0 + (1 - 1) * hop_count) = 1 - 1/0 = some kind of infinity (or NaN?).
(GDS_NSE_get() is (an approximation of) the logarithm of the network size, so it is approx. equal to 0 here).

So target_value becomes infinity (or, allowing for numerical issues, at least very large in magnitude).
Then the forward count is set to

  forward_count = (uint32_t) target_value

I don't know what is the result of casting an infinity or NaN to an integral type, but I wouldn't recommend it. Maybe it can be very large?
Steps To ReproduceFor developing/testing Scheme-GNUnet, I run the following services: dht, statistics, core, nse and peerinfo (no ARM!).
TagsNo tags attached.

Activities

md

2021-10-06 14:36

reporter   ~0018428

My calculation for target_replication=0 and GDS_NSE_get()=0 is bogus, it should be

target_value = 1 - 1/(0 + -1* hop_count)= 1 + 1/hop_count.

However, an infinity is still possible if hop_count = 0. I don't know if that can happen though.

Christian Grothoff

2021-10-06 16:51

manager   ~0018429

Seems likely. Still, how did you end up with a target_replication of 0?

Christian Grothoff

2021-10-06 16:53

manager   ~0018430

Fix committed to master branch.

Christian Grothoff

2021-10-06 16:54

manager   ~0018431

e173017ed..6ef071b8c fixes the crash by forcing the target_replication to be in a 'sane' range. Still wonder how 0 appeared, but at least the crash should be fixed now.

md

2021-10-06 17:02

reporter   ~0018432

The example mini-application I'm writing allows choosing any replication level, including 0. I'll look into making the minimum level 1!

Unfortunately, Mantis doesn't allow commenting on resolves issues, so I had to reopen the issue.

Christian Grothoff

2021-10-06 17:07

manager   ~0018433

I see. Ok, that explains it then. reopening: no problem. I'll consider this resolved then.

schanzen

2022-02-26 22:10

administrator   ~0018729

0.16.0 released

Issue History

Date ModifiedUsernameFieldChange
2021-10-05 18:45mdNew Issue
2021-10-06 10:19Christian GrothoffAssigned To => Christian Grothoff
2021-10-06 10:19Christian GrothoffStatusnew => assigned
2021-10-06 14:36mdNote Added: 0018428
2021-10-06 16:51Christian GrothoffNote Added: 0018429
2021-10-06 16:53Christian Grothoff
2021-10-06 16:53Christian GrothoffNote Added: 0018430
2021-10-06 16:53Christian GrothoffStatusassigned => resolved
2021-10-06 16:53Christian GrothoffResolutionopen => fixed
2021-10-06 16:54Christian GrothoffNote Added: 0018431
2021-10-06 17:02mdStatusresolved => feedback
2021-10-06 17:02mdResolutionfixed => reopened
2021-10-06 17:02mdNote Added: 0018432
2021-10-06 17:07Christian GrothoffNote Added: 0018433
2021-10-06 17:07Christian GrothoffStatusfeedback => resolved
2021-10-06 17:07Christian GrothoffFixed in Version => 0.15.4
2021-10-10 18:17schanzenTarget Version => 0.15.4
2021-12-31 08:26schanzenTarget Version0.15.4 => 0.16.0
2022-02-22 22:06schanzenFixed in Version => 0.16.0
2022-02-26 22:10schanzenNote Added: 0018729
2022-02-26 22:10schanzenStatusresolved => closed