View Issue Details

IDProjectCategoryView StatusLast Update
0003554GNUnettransport servicepublic2018-06-07 00:25
ReporteramatusAssigned ToChristian Grothoff 
PriorityurgentSeverityblockReproducibilitysometimes
Status closedResolutionfixed 
Product VersionSVN HEAD 
Target Version0.11.0pre66Fixed in Version0.11.0pre66 
Summary0003554: Transport session stuck in state S_SYN_RECV_ATS
DescriptionI have a normal gnunet peer I'll call "gnunet" which is running http_server transport and a gnunet-web peer that tries to connect to it I'll call "gnunet-web". I'm running into a problem frequently now where:

gnunet-web -> gnunet: PING
gnunet -> gnunet-web: PONG
gnunet -> gnunet-web: SYN
gnunet: SYN timeout, goes into state S_INIT_ATS
gnunet-web -> gnunet: SYN
gnunet: Goes into state S_SYN_RECV_ATS then does nothing, like it's waiting for something from ATS but ATS didn't know.

I've attached a "transport;;;;DEBUG" log for "gnunet".

Should "gnunet" be going into state S_INIT_ATS on a SYN timeout?
Should it be calling GNUNET_ATS_address_destroyed() like the other cases that enter this state with the same comment: "Remove address and request and additional one"?
There's also the comment "Hard failure to send the SYN message with this address: Destroy address and session", but no code that seems to do this.
BTW, the reason the SYN timed out in the first place was because gnunet-web hadn't finished loading ATS yet and transport timed out waiting for ATS.
TagsNo tags attached.

Activities

amatus

2014-10-19 02:16

developer  

gnunet.log (56,329 bytes)

cy1

2014-12-16 11:19

reporter  

gnunet-syn-dropper.patch (2,161 bytes)
Index: src/transport/gnunet-service-transport.c
===================================================================
--- src/transport/gnunet-service-transport.c	(revision 34549)
+++ src/transport/gnunet-service-transport.c	(working copy)
@@ -1168,7 +1168,7 @@
   GST_ats = GNUNET_ATS_scheduling_init (GST_cfg, &ats_request_address_change,
       NULL );
   GST_manipulation_init (GST_cfg);
-  GST_plugins_load (&GST_manipulation_recv,
+  GST_plugins_load (&GST_manipulation_recv_dropper,
                     &GST_neighbours_register_quota_notification,
                     &GST_neighbours_unregister_quota_notification,
                     &plugin_env_address_change_notification,
Index: src/transport/gnunet-service-transport_manipulation.c
===================================================================
--- src/transport/gnunet-service-transport_manipulation.c	(revision 34549)
+++ src/transport/gnunet-service-transport_manipulation.c	(working copy)
@@ -567,6 +567,17 @@
 
 }
 
+struct GNUNET_TIME_Relative
+GST_manipulation_recv_dropper (void *cls,
+    const struct GNUNET_HELLO_Address *address,
+    struct Session *session,
+    const struct GNUNET_MessageHeader *message)
+{
+    uint16_t type = ntohs(message->type);
+    if(type == GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_SYN && 0 == random() % 10)
+        return GNUNET_TIME_UNIT_ZERO;
+    return GST_manipulation_recv(cls,address,session,message);
+}
 /**
  * Initialize traffic manipulation
  *
Index: src/transport/gnunet-service-transport_manipulation.h
===================================================================
--- src/transport/gnunet-service-transport_manipulation.h	(revision 34549)
+++ src/transport/gnunet-service-transport_manipulation.h	(working copy)
@@ -81,6 +81,11 @@
     struct Session *session,
     const struct GNUNET_MessageHeader *message);
 
+struct GNUNET_TIME_Relative
+GST_manipulation_recv_dropper (void *cls,
+    const struct GNUNET_HELLO_Address *address,
+    struct Session *session,
+    const struct GNUNET_MessageHeader *message);
 /**
  * Function that will be called to manipulate ATS information according to
  * current manipulation settings
gnunet-syn-dropper.patch (2,161 bytes)

cy1

2014-12-16 11:19

reporter   ~0008695

You were looking for a thing to drop SYNs for testing. How's about something like this? I just added a random SYN dropper but you could do whatever you wanted in there.

cy1

2014-12-17 18:24

reporter   ~0008705

The reason I was thinking of making a wrapper around GST_manipulation_recv instead of just writing the code in that function or adding a CPP macro or something, was that GST_plugins_load is already a hook API. My example is kind of trivial but for instance if you just set the plugin->receive callback, you could even have something dynamically loaded that added SYN dropping to an existing, already compiled transport plugin. It's like using LD_PRELOAD except you can swap out the function pointer any time in the program's life and LD_PRELOAD only works if GST_manipulation_recv is off in a .so library itself anyway.

But that's kind of too fancy if you just want to compile your own gnunet-service-transport that drops SYN messages randomly, so in that case I'd just put a DEBUG_MAYBE_DROP_SYN in the body of GST_manipulation_recv, and #define it to either nothing, or a conditional statement, depending on whether you want the debugging instrumentation in there.

I really don't know exactly what you want here.

cy1

2014-12-23 04:28

reporter   ~0008724

On line 2363 of gnunet-service-transport_neighbors.c it says:
 /* SYN message takes priority over us asking ATS for address:
     * Wait for ATS to suggest an address and send SYN_ACK */

and then sets SYN_RECV_ATS on that neighbor. I think that's where the problem might be. That code has to let ATS know right there that it needs an address for that neighbor, and doesn't. GNUNET_ATS_suggest_address() might need to be called, as is with the NOT_CONNECTED state above. Apparantly a SYN_ACK will not be sent unless you ask ATS to suggest an address.

amatus

2015-01-01 20:33

developer   ~0008747

I added the test_transport_api_slow_ats test to reproduce this issue. Instead of trying to drop the SYN it just delays the start of the ATS service so the SYN_ACK comes too late as it was happening with gnunet-web.

Christian Grothoff

2015-02-10 12:39

manager   ~0008854

Amatus's test now passes (as do the others on my system), and various issues where ATS might not suggest an address were fixed. Please open a new report for anything that is still not going OK.

Issue History

Date Modified Username Field Change
2014-10-19 02:16 amatus New Issue
2014-10-19 02:16 amatus Status new => assigned
2014-10-19 02:16 amatus Assigned To => Matthias Wachs
2014-10-19 02:16 amatus File Added: gnunet.log
2014-11-07 18:47 Christian Grothoff Target Version => 0.11.0pre66
2014-12-15 21:00 Christian Grothoff Severity minor => block
2014-12-16 11:19 cy1 File Added: gnunet-syn-dropper.patch
2014-12-16 11:19 cy1 Note Added: 0008695
2014-12-16 19:36 Christian Grothoff Priority normal => urgent
2014-12-17 18:24 cy1 Note Added: 0008705
2014-12-23 04:28 cy1 Note Added: 0008724
2015-01-01 20:33 amatus Note Added: 0008747
2015-02-10 12:39 Christian Grothoff Note Added: 0008854
2015-02-10 12:39 Christian Grothoff Status assigned => resolved
2015-02-10 12:39 Christian Grothoff Fixed in Version => 0.11.0pre66
2015-02-10 12:39 Christian Grothoff Resolution open => fixed
2015-02-10 12:39 Christian Grothoff Assigned To Matthias Wachs => Christian Grothoff
2018-06-07 00:25 Christian Grothoff Status resolved => closed