Hello,

it's kind of late and I am not 100% sure I'm getting this right, so would
be great if someone could double-check this:

Essentially, the runtime DNS resolution was never triggered for me. I
tracked this down to a signed/unsigned problem in the usage of
tick_is_expired() from checks.c:2158.

curr_resolution->last_resolution is being initialized to zero
(server.c:981), which in turn makes it say a few thousand after the value
of hold.valid is added (also checks.c:2158). It is then compared to now_ms,
which is an unsigned integer so large that it is out of the signed integer
range. Thus, the comparison will not get the expected result, as it is done
on integer values (now_ms cast to integer gave e.g. -1875721083 a few
minutes ago, which is undeniably smaller then 3000).

One way to fix this is to initialize curr_resolution->last_resolution to
now_ms instead of zero (attached "patch"), but then it only works because
both values are converted to negative integers. While I think that this
will reasonably hide the problem for the time being, I do think there is a
deeper problem here, which is the frequent passing of an unsigned integer
into a function that takes signed int as argument.

I see that tick_* is used all over the place, so I thought I would rather
consult someone before spending lots of time creating a patch that would
not be used. Also, I would need some more time to actually figure out what
the best solution would be.

Does anyone have any thoughts on this? Is someone maybe already aware of this?

Thanks a lot,
Conrad
-- 
Conrad Hoffmann
Traffic Engineer

SoundCloud Ltd. | Rheinsberger Str. 76/77, 10115 Berlin, Germany

Managing Director: Alexander Ljung | Incorporated in England & Wales
with Company No. 6343600 | Local Branch Office | AG Charlottenburg |
HRB 110657B
diff --git a/src/server.c b/src/server.c
index f3b0f16..e88302b 100644
--- a/src/server.c
+++ b/src/server.c
@@ -978,7 +978,7 @@ int parse_server(const char *file, int linenum, char **args, struct proxy *curpr
 			curr_resolution->status = RSLV_STATUS_NONE;
 			curr_resolution->step = RSLV_STEP_NONE;
 			/* a first resolution has been done by the configuration parser */
-			curr_resolution->last_resolution = 0;
+			curr_resolution->last_resolution = now_ms;
 			newsrv->resolution = curr_resolution;
 
  skip_name_resolution:

Reply via email to