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

infinite loops with scallion and tor-0.2.4.x #201

Closed
robgjansen opened this issue Apr 28, 2014 · 3 comments
Closed

infinite loops with scallion and tor-0.2.4.x #201

robgjansen opened this issue Apr 28, 2014 · 3 comments
Assignees

Comments

Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
@robgjansen
Copy link
Member

@robgjansen robgjansen commented Apr 28, 2014

As a result of ticket 9731, Tor changed the functions connection_consider_empty_write_buckets and connection_consider_empty_read_buckets, which caused inifinite loops in shadow. I believe the infinite loops were fixed in the following commits:

https://gitweb.torproject.org/tor.git/commitdiff/96f92f2062118b61a43134170b92001d3be1c128?hp=702c0502cf3121e2e698963cf53adb00ae2d136d
https://gitweb.torproject.org/tor.git/commitdiff/8f793c38fbcd885d40adf8312ef1767e172e1be4?hp=96f92f2062118b61a43134170b92001d3be1c128

The fix on Tor's end has not been backported into 0.2.4.x yet. So the workaround is making the changes above manually or using tor-0.2.5.x. I opened Tor ticket 11638 requesting a fix on 0.2.4.

@robgjansen robgjansen added this to the release-1.10.0 milestone Apr 28, 2014
@robgjansen robgjansen self-assigned this Sep 8, 2014
@robgjansen robgjansen removed the wontfix label Sep 8, 2014
@robgjansen
Copy link
Member Author

@robgjansen robgjansen commented Sep 8, 2014

This seems to work correctly using the following

shadow

shadow-plugin-tor

Tor

@robgjansen
Copy link
Member Author

@robgjansen robgjansen commented Sep 9, 2014

I ran 10 simulations with the above code and the 400 relay config here as well as a 3600 relay experiment, and they all completed successfully.

@robgjansen robgjansen changed the title infinite loops with scallion and tor-0.2.4.20 infinite loops with scallion and tor-0.2.4.x Sep 12, 2014
@robgjansen
Copy link
Member Author

@robgjansen robgjansen commented Sep 12, 2014

Tor will not be merging Nick's fix into 0.2.4.x. Here is the diff of the fix against the latest stable tor-0.2.4.23. If you run into this infinite loop problem, please either merge Nick's branch as described above, or merge this patch.

diff --git a/changes/bug9731_full_backport b/changes/bug9731_full_backport
new file mode 100644
index 0000000..16806eb
--- /dev/null
+++ b/changes/bug9731_full_backport
@@ -0,0 +1,7 @@
+  o Minor bugfixes (backport from 0.2.5.1-alpha):
+    - No longer apply rate-limiting to any non-rate-limited connection.  Our
+      earlier fix in 0.2.4.18-rc applied later in the calculation, applied
+      only to CPUWorker connections, and led to infinite loops with the
+      Shadow network simulation tool. Fixes bug 11638, and backports an
+      improved fix for bug 9731. Bugfix on 0.2.4.18-rc.
+
diff --git a/src/or/connection.c b/src/or/connection.c
index 4f74a1d..275d562 100644
--- a/src/or/connection.c
+++ b/src/or/connection.c
@@ -2508,6 +2508,9 @@ connection_consider_empty_read_buckets(connection_t *conn)
 {
   const char *reason;

+  if (!connection_is_rate_limited(conn))
+    return; /* Always okay. */
+
   if (global_read_bucket <= 0) {
     reason = "global read bucket exhausted. Pausing.";
   } else if (connection_counts_as_relayed_traffic(conn, approx_time()) &&
@@ -2520,9 +2523,6 @@ connection_consider_empty_read_buckets(connection_t *conn)
   } else
     return; /* all good, no need to stop it */

-  if (conn->type == CONN_TYPE_CPUWORKER)
-    return; /* Always okay. */
-
   LOG_FN_CONN(conn, (LOG_DEBUG, LD_NET, "%s", reason));
   conn->read_blocked_on_bw = 1;
   connection_stop_reading(conn);
@@ -2535,6 +2535,9 @@ connection_consider_empty_write_buckets(connection_t *conn)
 {
   const char *reason;

+  if (!connection_is_rate_limited(conn))
+    return; /* Always okay. */
+
   if (global_write_bucket <= 0) {
     reason = "global write bucket exhausted. Pausing.";
   } else if (connection_counts_as_relayed_traffic(conn, approx_time()) &&
@@ -2547,9 +2550,6 @@ connection_consider_empty_write_buckets(connection_t *conn)
   } else
     return; /* all good, no need to stop it */

-  if (conn->type == CONN_TYPE_CPUWORKER)
-    return; /* Always okay. */
-
   LOG_FN_CONN(conn, (LOG_DEBUG, LD_NET, "%s", reason));
   conn->write_blocked_on_bw = 1;
   connection_stop_writing(conn);

@robgjansen robgjansen closed this Sep 12, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment