unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* RE: Fibers web server: use multiple server sockets
@ 2022-11-02 18:15 dsmich
  2022-11-02 18:27 ` Vivien Kraus
  2022-11-02 19:19 ` tomas
  0 siblings, 2 replies; 7+ messages in thread
From: dsmich @ 2022-11-02 18:15 UTC (permalink / raw)
  To: 'Vivien Kraus'; +Cc: 'guile-user'

> From: "Vivien Kraus" 
> To: "guile-user"
> Sent: Wednesday November 2 2022 12:38:05PM
> Subject: Fibers web server: use multiple server sockets

> Fibers is a library that I would very much like to use. It provides
a
> nice web server. However, as I recently discovered, in a standard
> GNU/Linux server, not all network interfaces and addresses are up
when
> the server is about to start (especially so with dhcp). I have a
nice
> solution for that: every now and then, the server calls getaddrinfo.

How about not starting the web server until network interfaces are
fully up?

-Dale




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Fibers web server: use multiple server sockets
  2022-11-02 18:15 Fibers web server: use multiple server sockets dsmich
@ 2022-11-02 18:27 ` Vivien Kraus
  2022-11-02 19:19 ` tomas
  1 sibling, 0 replies; 7+ messages in thread
From: Vivien Kraus @ 2022-11-02 18:27 UTC (permalink / raw)
  To: dsmich; +Cc: 'guile-user'

Hello Dale,

There are 2 init systems that matter: shepherd (because it’s guile and
used in guix) and systemd (because nearly everyone uses it).

Le mercredi 02 novembre 2022 à 18:15 +0000, dsmich@roadrunner.com a
écrit :
> How about not starting the web server until network interfaces are
> fully up?

As far as I understand, there is no such thing with shepherd. As for
systemd, this [1] is an interesting read and it shows that it’s up to
me to write my server such that it can adapt to dynamic configuration
changes.

[1] https://systemd.io/NETWORK_ONLINE/

Vivien



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Fibers web server: use multiple server sockets
  2022-11-02 18:15 Fibers web server: use multiple server sockets dsmich
  2022-11-02 18:27 ` Vivien Kraus
@ 2022-11-02 19:19 ` tomas
  2022-11-02 19:35   ` Dr. Arne Babenhauserheide
  1 sibling, 1 reply; 7+ messages in thread
From: tomas @ 2022-11-02 19:19 UTC (permalink / raw)
  To: guile-user

[-- Attachment #1: Type: text/plain, Size: 955 bytes --]

On Wed, Nov 02, 2022 at 06:15:15PM +0000, dsmich@roadrunner.com wrote:
> > From: "Vivien Kraus" 
> > To: "guile-user"
> > Sent: Wednesday November 2 2022 12:38:05PM
> > Subject: Fibers web server: use multiple server sockets
> 
> > Fibers is a library that I would very much like to use. It provides
> a
> > nice web server. However, as I recently discovered, in a standard
> > GNU/Linux server, not all network interfaces and addresses are up
> when
> > the server is about to start (especially so with dhcp). I have a
> nice
> > solution for that: every now and then, the server calls getaddrinfo.
> 
> How about not starting the web server until network interfaces are
> fully up?

As far as I understand Vivien, interfaces come and go during the
server's lifetime. I.e. it's not just a "boot" thing. This seems
like a valid use case.

You could, of course, restart the server every time an interface
moves...

Cheers
-- 
t

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Fibers web server: use multiple server sockets
  2022-11-02 19:19 ` tomas
@ 2022-11-02 19:35   ` Dr. Arne Babenhauserheide
  2022-11-02 19:57     ` tomas
  0 siblings, 1 reply; 7+ messages in thread
From: Dr. Arne Babenhauserheide @ 2022-11-02 19:35 UTC (permalink / raw)
  To: tomas; +Cc: guile-user

[-- Attachment #1: Type: text/plain, Size: 454 bytes --]


<tomas@tuxteam.de> writes:
> As far as I understand Vivien, interfaces come and go during the
> server's lifetime. I.e. it's not just a "boot" thing. This seems
> like a valid use case.
On some servers you might actually pull out an interface during runtime
to hotswap a new one — for example because it signaled that it is short
of failing.

Best wishes,
Arne
-- 
Unpolitisch sein
heißt politisch sein,
ohne es zu merken.
draketo.de

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 1125 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Fibers web server: use multiple server sockets
  2022-11-02 19:35   ` Dr. Arne Babenhauserheide
@ 2022-11-02 19:57     ` tomas
  2022-11-02 23:04       ` Ricardo Wurmus
  0 siblings, 1 reply; 7+ messages in thread
From: tomas @ 2022-11-02 19:57 UTC (permalink / raw)
  To: Dr. Arne Babenhauserheide; +Cc: guile-user

[-- Attachment #1: Type: text/plain, Size: 730 bytes --]

On Wed, Nov 02, 2022 at 08:35:24PM +0100, Dr. Arne Babenhauserheide wrote:
> 
> <tomas@tuxteam.de> writes:
> > As far as I understand Vivien, interfaces come and go during the
> > server's lifetime. I.e. it's not just a "boot" thing. This seems
> > like a valid use case.
> On some servers you might actually pull out an interface during runtime
> to hotswap a new one — for example because it signaled that it is short
> of failing.

Yes, but as Vivien explained his case, just the other side of the network
might go down. Or the dhcp server at the other side takes too long and we
don't want to block the boot. Or the sysadmin just does "ifdown eth0"
and somewhat later "ifup...". Or whatever.

Cheers
-- 
t

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Fibers web server: use multiple server sockets
  2022-11-02 19:57     ` tomas
@ 2022-11-02 23:04       ` Ricardo Wurmus
  0 siblings, 0 replies; 7+ messages in thread
From: Ricardo Wurmus @ 2022-11-02 23:04 UTC (permalink / raw)
  To: tomas; +Cc: Dr. Arne Babenhauserheide, guile-user


tomas@tuxteam.de writes:

> [[PGP Signed Part:Undecided]]
> On Wed, Nov 02, 2022 at 08:35:24PM +0100, Dr. Arne Babenhauserheide wrote:
>> 
>> <tomas@tuxteam.de> writes:
>> > As far as I understand Vivien, interfaces come and go during the
>> > server's lifetime. I.e. it's not just a "boot" thing. This seems
>> > like a valid use case.
>> On some servers you might actually pull out an interface during runtime
>> to hotswap a new one — for example because it signaled that it is short
>> of failing.
>
> Yes, but as Vivien explained his case, just the other side of the network
> might go down. Or the dhcp server at the other side takes too long and we
> don't want to block the boot. Or the sysadmin just does "ifdown eth0"
> and somewhat later "ifup...". Or whatever.

Expanding on “whatever”: it may be a virtual network interface.  In an
unshared net namespace we can move one end of a veth device into the
container’s net namespace — and we can just as well move it out again or
destroy it by removing its host-side counterpart.

An example of this is shown here:
https://guix.gnu.org/cookbook/en/html_node/Container-Networking.html

-- 
Ricardo



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Fibers web server: use multiple server sockets
@ 2022-11-02 16:37 Vivien Kraus
  0 siblings, 0 replies; 7+ messages in thread
From: Vivien Kraus @ 2022-11-02 16:37 UTC (permalink / raw)
  To: guile-user

Dear guile fiber users,

Fibers is a library that I would very much like to use. It provides a
nice web server. However, as I recently discovered, in a standard
GNU/Linux server, not all network interfaces and addresses are up when
the server is about to start (especially so with dhcp). I have a nice
solution for that: every now and then, the server calls getaddrinfo. If
a previously bound address does not appear anymore in the return value,
then close the socket it was bound to. If a new address is returned by
the function, create a new socket for it and bind it to the new address
(and listen). This means that if a new address appears for the host
argument, then the server will eventually listen to it without having
to restart anything. If an address is dropped, eventually the server
will stop listening to it.

I would like to have that in the fibers web server. However, I
understand that not everyone would want it, or some would do it
differently (e.g. by using guile-netlink or something else). I think
the web server should make “listen”, “fcntl” (for set-nonblocking!) and
“accept” generic (with parameters, or GOOPS, or…?) so that I could fit
my weird thing within the call to accept.
Ultimately, everything could be expressed in terms of “accept” and have
the default implementation call listen and set-nonblocking! lazily
during the first call to accept. 

What do you think? Should the fibers web server try to do the
getaddrinfo thing by itself or be extensible and let me do it myself?
Are you OK with GOOPS? Do you prefer parameters? Do you have other
options?

Best regards,

Vivien



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-11-02 23:04 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-02 18:15 Fibers web server: use multiple server sockets dsmich
2022-11-02 18:27 ` Vivien Kraus
2022-11-02 19:19 ` tomas
2022-11-02 19:35   ` Dr. Arne Babenhauserheide
2022-11-02 19:57     ` tomas
2022-11-02 23:04       ` Ricardo Wurmus
  -- strict thread matches above, loose matches on Subject: below --
2022-11-02 16:37 Vivien Kraus

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).