diff options
author | Christian Grothoff <christian@grothoff.org> | 2018-05-18 11:10:49 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2018-05-18 11:10:49 +0200 |
commit | 81b21482d14ea93df96c7f0709fa31a1939360ad (patch) | |
tree | 3cb2891369160d5e986b2498b470833b2b8908dc | |
parent | 9ae789822b9ec55bd20d4a68a28770b5b4c165f8 (diff) | |
download | gnunet-81b21482d14ea93df96c7f0709fa31a1939360ad.tar.gz gnunet-81b21482d14ea93df96c7f0709fa31a1939360ad.zip |
ancient debug patches can die
-rw-r--r-- | contrib/buildslave-0.8.6p1-gnunet-w32.patch | 202 | ||||
-rw-r--r-- | contrib/testbed_perfhacks.patch | 90 | ||||
-rw-r--r-- | contrib/transpot_delay.patch | 77 |
3 files changed, 0 insertions, 369 deletions
diff --git a/contrib/buildslave-0.8.6p1-gnunet-w32.patch b/contrib/buildslave-0.8.6p1-gnunet-w32.patch deleted file mode 100644 index 265db4d71..000000000 --- a/contrib/buildslave-0.8.6p1-gnunet-w32.patch +++ /dev/null | |||
@@ -1,202 +0,0 @@ | |||
1 | diff -urN /src/buildbot-slave-0.8.6p1.orig/buildslave/runprocess.py /src/buildbot-slave-0.8.6p1/buildslave/runprocess.py | ||
2 | --- buildbot-slave-0.8.6p1.orig/buildslave/runprocess.py 2012-03-26 04:09:10 +0400 | ||
3 | +++ buildbot-slave-0.8.6p1/buildslave/runprocess.py 2013-03-31 05:18:55 +0400 | ||
4 | @@ -24,6 +24,7 @@ | ||
5 | import re | ||
6 | import subprocess | ||
7 | import traceback | ||
8 | +import tempfile | ||
9 | import stat | ||
10 | from collections import deque | ||
11 | |||
12 | @@ -36,6 +37,89 @@ | ||
13 | if runtime.platformType == 'posix': | ||
14 | from twisted.internet.process import Process | ||
15 | |||
16 | +if os.name == 'nt': | ||
17 | + import win32api | ||
18 | + import win32process | ||
19 | + import win32event | ||
20 | + import pywintypes | ||
21 | + | ||
22 | +def safe_terminate_process (proc, code): | ||
23 | + if os.name == 'nt': | ||
24 | + log.msg ("Obtaining current process handle") | ||
25 | + cp = win32api.GetCurrentProcess () | ||
26 | + result = False | ||
27 | + log.msg ("Expanding target process handle permissions") | ||
28 | + dupproc = win32api.DuplicateHandle (cp, proc._handle, cp, 2 | 1024 | 8 | 32 | 16 | 0x100000, 0, 0) | ||
29 | + log.msg ("Expanded.") | ||
30 | + try: | ||
31 | + log.msg ("Checking exit code of target process") | ||
32 | + exitcode = win32process.GetExitCodeProcess (dupproc) | ||
33 | + log.msg ("Exit code is %d" % exitcode) | ||
34 | + if exitcode == 0x103: | ||
35 | + log.msg ("Opening kernel32.dll") | ||
36 | + kernel32 = win32api.GetModuleHandle ("kernel32") | ||
37 | + log.msg ("Getting ExitProcess() address") | ||
38 | + exitprocess = win32api.GetProcAddress (kernel32, "ExitProcess") | ||
39 | + try: | ||
40 | + log.msg ("Creating remote thread") | ||
41 | + th = 0 | ||
42 | + tid = 0 | ||
43 | + failed = False | ||
44 | + th, tid = win32process.CreateRemoteThread (dupproc, None, 0, exitprocess, code, 0) | ||
45 | + log.msg ("Created remote thread %d" % tid) | ||
46 | + except pywintypes.error as e: | ||
47 | + if e[0] == 5: | ||
48 | + log.msg ("Access denied. It still might die, so don't fail yet") | ||
49 | + pass | ||
50 | + else: | ||
51 | + log.msg("exception %s - %s" % (sys.exc_info()[0], sys.exc_info()[1])) | ||
52 | + failed = True | ||
53 | + except Exception as e: | ||
54 | + log.msg("exception %s - %s" % (sys.exc_info()[0], sys.exc_info()[1])) | ||
55 | + failed = True | ||
56 | + if not failed: | ||
57 | + log.msg ("Wait for 5 seconds or until it dies (usually takes around 1 microsecond)") | ||
58 | + waitresult = win32event.WaitForSingleObject (dupproc, 5) | ||
59 | + log.msg ("Result of waiting: %d" % waitresult) | ||
60 | + win32api.CloseHandle (th) | ||
61 | + if waitresult == 0: | ||
62 | + result = True | ||
63 | + else: | ||
64 | + result = True | ||
65 | + except: | ||
66 | + log.msg("exception %s - %s" % (sys.exc_info()[0], sys.exc_info()[1])) | ||
67 | + finally: | ||
68 | + win32api.CloseHandle (dupproc) | ||
69 | + return result | ||
70 | + else: | ||
71 | + return proc.kill () | ||
72 | + | ||
73 | +class Dummy(object): | ||
74 | + def SetHandle (self, h): | ||
75 | + self._handle = h | ||
76 | + | ||
77 | +def safe_terminate_process_by_pid (proc, code): | ||
78 | + if os.name == 'nt': | ||
79 | + try: | ||
80 | + log.msg("Opening process %d" % proc) | ||
81 | + openproc = win32api.OpenProcess (2 | 1024 | 8 | 32 | 16 | 0x100000, 0, proc) | ||
82 | + log.msg("Opened process %d" % proc) | ||
83 | + try: | ||
84 | + d = Dummy () | ||
85 | + d.SetHandle (openproc) | ||
86 | + log.msg("Terminating it safely") | ||
87 | + safe_terminate_process (d, code) | ||
88 | + log.msg("Finished terminating") | ||
89 | + finally: | ||
90 | + log.msg("Closing process handle") | ||
91 | + win32api.CloseHandle (openproc) | ||
92 | + except: | ||
93 | + log.msg("exception %s - %s" % (sys.exc_info()[0], sys.exc_info()[1])) | ||
94 | + pass | ||
95 | + else: | ||
96 | + return os.kill (proc, code) | ||
97 | + | ||
98 | + | ||
99 | def shell_quote(cmd_list): | ||
100 | # attempt to quote cmd_list such that a shell will properly re-interpret | ||
101 | # it. The pipes module is only available on UNIX, and Windows "shell" | ||
102 | @@ -148,6 +232,7 @@ | ||
103 | self.pending_stdin = "" | ||
104 | self.stdin_finished = False | ||
105 | self.killed = False | ||
106 | + self.scriptfile = "" | ||
107 | |||
108 | def setStdin(self, data): | ||
109 | assert not self.connected | ||
110 | @@ -198,6 +283,11 @@ | ||
111 | rc = 1 | ||
112 | else: | ||
113 | rc = -1 | ||
114 | + if self.scriptfile: | ||
115 | + try: | ||
116 | + os.remove (self.scriptfile) | ||
117 | + except: | ||
118 | + pass | ||
119 | self.command.finished(sig, rc) | ||
120 | |||
121 | |||
122 | @@ -408,9 +498,14 @@ | ||
123 | |||
124 | if type(self.command) in types.StringTypes: | ||
125 | if runtime.platformType == 'win32': | ||
126 | - argv = os.environ['COMSPEC'].split() # allow %COMSPEC% to have args | ||
127 | - if '/c' not in argv: argv += ['/c'] | ||
128 | - argv += [self.command] | ||
129 | + if os.environ['BUILDSLAVE_SHELL']: | ||
130 | + argv = os.environ['BUILDSLAVE_SHELL'].split() # allow %COMSPEC% to have args | ||
131 | + argv += [self.command] | ||
132 | + else: | ||
133 | + argv = os.environ['COMSPEC'].split() # allow %COMSPEC% to have args | ||
134 | + if '/c' not in argv: | ||
135 | + argv += ['/c'] | ||
136 | + argv += [self.command] | ||
137 | else: | ||
138 | # for posix, use /bin/sh. for other non-posix, well, doesn't | ||
139 | # hurt to try | ||
140 | @@ -424,9 +519,26 @@ | ||
141 | # handle path searching, etc. | ||
142 | if runtime.platformType == 'win32' and not \ | ||
143 | (self.command[0].lower().endswith(".exe") and os.path.isabs(self.command[0])): | ||
144 | - argv = os.environ['COMSPEC'].split() # allow %COMSPEC% to have args | ||
145 | - if '/c' not in argv: argv += ['/c'] | ||
146 | - argv += list(self.command) | ||
147 | + if os.environ['BUILDSLAVE_SHELL']: | ||
148 | + argv = os.environ['BUILDSLAVE_SHELL'].split() | ||
149 | + # Create a temporary script file that changes current directory | ||
150 | + # and runs the command we want | ||
151 | + # It will be deleted after command is finished running (see RunProcessPP) | ||
152 | + tf, tf_name = tempfile.mkstemp () | ||
153 | + f = os.fdopen (tf, 'wb') | ||
154 | + fcontents = '#!/bin/sh\ncd {}\n{}'.format ( | ||
155 | + re.sub(r'(?<!\\) ','\\ ', self.workdir.replace('\\','/')), | ||
156 | + ' '.join (self.command)) | ||
157 | + f.write (fcontents) | ||
158 | + log.msg("Script: {}".format (fcontents)) | ||
159 | + f.close () | ||
160 | + self.pp.scriptfile = tf_name | ||
161 | + argv += [tf_name.replace('\\','/')] | ||
162 | + else: | ||
163 | + argv = os.environ['COMSPEC'].split() # allow %COMSPEC% to have args | ||
164 | + if '/c' not in argv: | ||
165 | + argv += ['/c'] | ||
166 | + argv += list(self.command) | ||
167 | else: | ||
168 | argv = self.command | ||
169 | # Attempt to format this for use by a shell, although the process isn't perfect | ||
170 | @@ -439,7 +551,7 @@ | ||
171 | self.environ['PWD'] = os.path.abspath(self.workdir) | ||
172 | |||
173 | # self.stdin is handled in RunProcessPP.connectionMade | ||
174 | - | ||
175 | + log.msg("Running {}".format (argv)) | ||
176 | log.msg(" " + display) | ||
177 | self._addToBuffers('header', display+"\n") | ||
178 | |||
179 | @@ -770,9 +882,7 @@ | ||
180 | if self.interruptSignal == None: | ||
181 | log.msg("self.interruptSignal==None, only pretending to kill child") | ||
182 | else: | ||
183 | - log.msg("using TASKKILL /F PID /T to kill pid %s" % self.process.pid) | ||
184 | - subprocess.check_call("TASKKILL /F /PID %s /T" % self.process.pid) | ||
185 | - log.msg("taskkill'd pid %s" % self.process.pid) | ||
186 | + safe_terminate_process_by_pid (self.process.pid, 1) | ||
187 | hit = 1 | ||
188 | |||
189 | # try signalling the process itself (works on Windows too, sorta) | ||
190 | @@ -795,10 +905,11 @@ | ||
191 | if not hit: | ||
192 | log.msg("signalProcess/os.kill failed both times") | ||
193 | |||
194 | - if runtime.platformType == "posix": | ||
195 | + if runtime.platformType == "posix" or runtime.platformType == "win32": | ||
196 | # we only do this under posix because the win32eventreactor | ||
197 | # blocks here until the process has terminated, while closing | ||
198 | # stderr. This is weird. | ||
199 | + # LRN: Turns out, things don't work without this on W32. At all. | ||
200 | self.pp.transport.loseConnection() | ||
201 | |||
202 | if self.deferred: | ||
diff --git a/contrib/testbed_perfhacks.patch b/contrib/testbed_perfhacks.patch deleted file mode 100644 index 1ad524a30..000000000 --- a/contrib/testbed_perfhacks.patch +++ /dev/null | |||
@@ -1,90 +0,0 @@ | |||
1 | Index: src/include/gnunet_constants.h | ||
2 | =================================================================== | ||
3 | --- src/include/gnunet_constants.h (revision 26030) | ||
4 | +++ src/include/gnunet_constants.h (working copy) | ||
5 | @@ -49,7 +49,7 @@ | ||
6 | * After how long do we consider a connection to a peer dead | ||
7 | * if we don't receive messages from the peer? | ||
8 | */ | ||
9 | -#define GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 5) | ||
10 | +#define GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_YEARS, 5) | ||
11 | |||
12 | /** | ||
13 | * How long do we delay reading more from a peer after a quota violation? | ||
14 | @@ -61,7 +61,7 @@ | ||
15 | * even if we assume that the service commonly does not | ||
16 | * respond instantly (DNS, Database, etc.). | ||
17 | */ | ||
18 | -#define GNUNET_CONSTANTS_SERVICE_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 10) | ||
19 | +#define GNUNET_CONSTANTS_SERVICE_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_YEARS, 10) | ||
20 | |||
21 | /** | ||
22 | * How long do we delay messages to get larger packet sizes (CORKing)? | ||
23 | Index: src/transport/gnunet-service-transport_neighbours.c | ||
24 | =================================================================== | ||
25 | --- src/transport/gnunet-service-transport_neighbours.c (revision 26030) | ||
26 | +++ src/transport/gnunet-service-transport_neighbours.c (working copy) | ||
27 | @@ -65,7 +65,7 @@ | ||
28 | * send 3 keepalives in each interval, so 3 messages would need to be | ||
29 | * lost in a row for a disconnect). | ||
30 | */ | ||
31 | -#define KEEPALIVE_FREQUENCY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 100) | ||
32 | +#define KEEPALIVE_FREQUENCY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_YEARS, 100) | ||
33 | |||
34 | /** | ||
35 | * How long are we willing to wait for a response from ATS before timing out? | ||
36 | Index: src/transport/gnunet-service-transport_validation.c | ||
37 | =================================================================== | ||
38 | --- src/transport/gnunet-service-transport_validation.c (revision 26030) | ||
39 | +++ src/transport/gnunet-service-transport_validation.c (working copy) | ||
40 | @@ -43,7 +43,7 @@ | ||
41 | * OTOH, we don't want to spend too much time generating PONG signatures, | ||
42 | * so they must have some lifetime to reduce our CPU usage. | ||
43 | */ | ||
44 | -#define PONG_SIGNATURE_LIFETIME GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_HOURS, 1) | ||
45 | +#define PONG_SIGNATURE_LIFETIME GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_HOURS, 12) | ||
46 | |||
47 | /** | ||
48 | * After how long do we expire an address in a HELLO that we just | ||
49 | @@ -58,24 +58,24 @@ | ||
50 | * we cannot validate (because after this time we can destroy the | ||
51 | * validation record). | ||
52 | */ | ||
53 | -#define UNVALIDATED_PING_KEEPALIVE GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 5) | ||
54 | +#define UNVALIDATED_PING_KEEPALIVE GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_HOURS, 4) | ||
55 | |||
56 | /** | ||
57 | * How often do we PING an address that we have successfully validated | ||
58 | * in the past but are not actively using? Should be (significantly) | ||
59 | * smaller than HELLO_ADDRESS_EXPIRATION. | ||
60 | */ | ||
61 | -#define VALIDATED_PING_FREQUENCY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 15) | ||
62 | +#define VALIDATED_PING_FREQUENCY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_HOURS, 6) | ||
63 | |||
64 | /** | ||
65 | * How often do we PING an address that we are currently using? | ||
66 | */ | ||
67 | -#define CONNECTED_PING_FREQUENCY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 2) | ||
68 | +#define CONNECTED_PING_FREQUENCY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_YEARS, 2) | ||
69 | |||
70 | /** | ||
71 | * How much delay is acceptable for sending the PING or PONG? | ||
72 | */ | ||
73 | -#define ACCEPTABLE_PING_DELAY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 1) | ||
74 | +#define ACCEPTABLE_PING_DELAY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 1) | ||
75 | |||
76 | /** | ||
77 | * Size of the validation map hashmap. | ||
78 | @@ -745,9 +745,9 @@ | ||
79 | void | ||
80 | GST_validation_start (unsigned int max_fds) | ||
81 | { | ||
82 | - validation_next = GNUNET_TIME_absolute_get(); | ||
83 | - validation_delay.rel_value = (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT.rel_value) / max_fds; | ||
84 | - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Delay between validations: %u ms\n ", validation_delay.rel_value); | ||
85 | + validation_next = GNUNET_TIME_absolute_get(); | ||
86 | + validation_delay.rel_value = GNUNET_TIME_UNIT_MILLISECONDS.rel_value; | ||
87 | + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Delay between validations: %u ms\n ", validation_delay.rel_value); | ||
88 | validation_map = GNUNET_CONTAINER_multihashmap_create (VALIDATION_MAP_SIZE, | ||
89 | GNUNET_NO); | ||
90 | pnc = GNUNET_PEERINFO_notify (GST_cfg, &process_peerinfo_hello, NULL); | ||
diff --git a/contrib/transpot_delay.patch b/contrib/transpot_delay.patch deleted file mode 100644 index 9ba806960..000000000 --- a/contrib/transpot_delay.patch +++ /dev/null | |||
@@ -1,77 +0,0 @@ | |||
1 | Index: src/transport/gnunet-service-transport_neighbours.c | ||
2 | =================================================================== | ||
3 | --- src/transport/gnunet-service-transport_neighbours.c (revision 27335) | ||
4 | +++ src/transport/gnunet-service-transport_neighbours.c (working copy) | ||
5 | @@ -65,7 +65,7 @@ | ||
6 | * send 3 keepalives in each interval, so 3 messages would need to be | ||
7 | * lost in a row for a disconnect). | ||
8 | */ | ||
9 | -#define KEEPALIVE_FREQUENCY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 100) | ||
10 | +#define KEEPALIVE_FREQUENCY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_YEARS, 100) | ||
11 | |||
12 | /** | ||
13 | * How long are we willing to wait for a response from ATS before timing out? | ||
14 | Index: src/transport/gnunet-service-transport_validation.c | ||
15 | =================================================================== | ||
16 | --- src/transport/gnunet-service-transport_validation.c (revision 27335) | ||
17 | +++ src/transport/gnunet-service-transport_validation.c (working copy) | ||
18 | @@ -42,7 +42,7 @@ | ||
19 | * OTOH, we don't want to spend too much time generating PONG signatures, | ||
20 | * so they must have some lifetime to reduce our CPU usage. | ||
21 | */ | ||
22 | -#define PONG_SIGNATURE_LIFETIME GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_HOURS, 1) | ||
23 | +#define PONG_SIGNATURE_LIFETIME GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_HOURS, 12) | ||
24 | |||
25 | /** | ||
26 | * After how long do we expire an address in a HELLO that we just | ||
27 | @@ -57,24 +57,24 @@ | ||
28 | * we cannot validate (because after this time we can destroy the | ||
29 | * validation record). | ||
30 | */ | ||
31 | -#define UNVALIDATED_PING_KEEPALIVE GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 5) | ||
32 | +#define UNVALIDATED_PING_KEEPALIVE GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_HOURS, 4) | ||
33 | |||
34 | /** | ||
35 | * How often do we PING an address that we have successfully validated | ||
36 | * in the past but are not actively using? Should be (significantly) | ||
37 | * smaller than HELLO_ADDRESS_EXPIRATION. | ||
38 | */ | ||
39 | -#define VALIDATED_PING_FREQUENCY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 15) | ||
40 | +#define VALIDATED_PING_FREQUENCY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_HOURS, 6) | ||
41 | |||
42 | /** | ||
43 | * How often do we PING an address that we are currently using? | ||
44 | */ | ||
45 | -#define CONNECTED_PING_FREQUENCY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 2) | ||
46 | +#define CONNECTED_PING_FREQUENCY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_YEARS, 2) | ||
47 | |||
48 | /** | ||
49 | * How much delay is acceptable for sending the PING or PONG? | ||
50 | */ | ||
51 | -#define ACCEPTABLE_PING_DELAY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 1) | ||
52 | +#define ACCEPTABLE_PING_DELAY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 1) | ||
53 | |||
54 | /** | ||
55 | * Size of the validation map hashmap. | ||
56 | Index: src/include/gnunet_constants.h | ||
57 | =================================================================== | ||
58 | --- src/include/gnunet_constants.h (revision 27335) | ||
59 | +++ src/include/gnunet_constants.h (working copy) | ||
60 | @@ -49,7 +49,7 @@ | ||
61 | * After how long do we consider a connection to a peer dead | ||
62 | * if we don't receive messages from the peer? | ||
63 | */ | ||
64 | -#define GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 5) | ||
65 | +#define GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_YEARS, 5) | ||
66 | |||
67 | /** | ||
68 | * How long do we delay reading more from a peer after a quota violation? | ||
69 | @@ -61,7 +61,7 @@ | ||
70 | * even if we assume that the service commonly does not | ||
71 | * respond instantly (DNS, Database, etc.). | ||
72 | */ | ||
73 | -#define GNUNET_CONSTANTS_SERVICE_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 10) | ||
74 | +#define GNUNET_CONSTANTS_SERVICE_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_YEARS, 10) | ||
75 | |||
76 | /** | ||
77 | * How long do we delay messages to get larger packet sizes (CORKing)? | ||