exit on select return -1 but errno == 0?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

exit on select return -1 but errno == 0?

Joe Maimon
running under gdb, server exits(1) after a bit


Breakpoint 15, main (argc=2, argv=0xbfe26764) at radiusd.c:600
600                             if (errno == EINTR) {
(gdb) p errno
$9 = 0
(gdb) p status
$10 = -1
(gdb)

Debian GNU/Linux
  dpkg -l libc6
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Installed/Config-files/Unpacked/Failed-config/Half-installed
|/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err:
uppercase=bad)
||/ Name                      Version                   Description
+++-=========================-=========================-==================================================================
ii  libc6                     2.3.5-6                   GNU C Library:
Shared libraries and Timezone data

-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/devel.html
Reply | Threaded
Open this post in threaded view
|

Re: exit on select return -1 but errno == 0?

Joe Maimon


in radiusd.c:720

-----------------------------
   for (listener = mainconfig.listen;
                              listener != NULL;
                              listener = listener->next) {
                                 int next;

                                 next = listener->update(listener,
time_now);
                                 if (next > 0 && next < sleep_time) {
                                         sleep_time = next;
                                 }


-------------------------------

I added the "next > 0 &&" because I was getting "sleeping for -1"....
and then the server would exit.



-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/devel.html
Reply | Threaded
Open this post in threaded view
|

Re: exit on select return -1 but errno == 0?

Alan DeKok
Joe Maimon <[hidden email]> wrote:
> I added the "next > 0 &&" because I was getting "sleeping for -1"....
> and then the server would exit.

  Yeah, that code is *bad*.  I'm in the process of figuring out what
it should do, as opposed to randomly changing the crap that's there.

  Alan DeKok.

-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/devel.html
Reply | Threaded
Open this post in threaded view
|

Re: exit on select return -1 but errno == 0?

Joe Maimon
In reply to this post by Joe Maimon
Alan,

With your fix for this issue, the server sometimes logs hundreds of
sleeping(it means select) for 0 seconds messages (in a row).

Should the server ever select for 0 seconds?


Joe

Joe Maimon wrote:

>
>
> in radiusd.c:720
>
> -----------------------------
>   for (listener = mainconfig.listen;
>                              listener != NULL;
>                              listener = listener->next) {
>                                 int next;
>
>                                 next = listener->update(listener,
> time_now);
>                                 if (next > 0 && next < sleep_time) {
>                                         sleep_time = next;
>                                 }
>
>
> -------------------------------
>
> I added the "next > 0 &&" because I was getting "sleeping for -1"....
> and then the server would exit.
>
>
>
> - List info/subscribe/unsubscribe? See
> http://www.freeradius.org/list/devel.html
>
>
-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/devel.html
Reply | Threaded
Open this post in threaded view
|

Re: exit on select return -1 but errno == 0?

Alan DeKok
Joe Maimon <[hidden email]> wrote:
> With your fix for this issue, the server sometimes logs hundreds of
> sleeping(it means select) for 0 seconds messages (in a row).
>
> Should the server ever select for 0 seconds?

  No.  It's a bug.  It's in 1.0.x, too, and I can't figure out what
code path creates the problem.

  The solution is to go to a state-driven approach.  I've done some
analysis, but I'm not sure how best to implement it.

  Alan DeKok.
-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/devel.html