Published service still browseable in other machines even if network it's down

View: New views
6 Messages — Rating Filter:   Alert me  

Published service still browseable in other machines even if network it's down

by José Félix Ontañón :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi everyone!

I'm a newbie playing with python-avahi trying to code some kind of master-slave application for shutdown every machine at same time.
When the master it's ordered to shutdown, it sends the signal to the slaves. The slaves publish/unpublish the service via avahi, and the master
discover them via ItemNew/ItemRemove signals. Very strait-forward, isn't?

The avahi publish/unpublish/discover services it's gorgeous but i've found that if a slave, that has published the service via avahi, losts it
network (i.e. the wifi ap goes out of power), the master still discovering it! and no ItemRemove signal it's raised at all. Is it normal? Am i doing something wrong?

To solve it, i've implemented some kind of "ping" to the slaves service every Xseconds. When a new slave it's discovered, the periodic ping starts.
When ping it's failing i know there be some problem with networking.

I wonder if avahi itself provides a native workaround to avoid the coding of those nasty "ping" cycles ...

Cheers!

--
http://nosigasleyendo.blogspot.com

_______________________________________________
avahi mailing list
avahi@...
http://lists.freedesktop.org/mailman/listinfo/avahi

Re: Published service still browseable in other machines even if network it's down

by Trent Lloyd :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Jose,

On 05/11/2009, at 6:35 AM, José Félix Ontañón wrote:

> Hi everyone!
>
> I'm a newbie playing with python-avahi trying to code some kind of  
> master-slave application for shutdown every machine at same time.
> When the master it's ordered to shutdown, it sends the signal to the  
> slaves. The slaves publish/unpublish the service via avahi, and the  
> master
> discover them via ItemNew/ItemRemove signals. Very strait-forward,  
> isn't?
>
> The avahi publish/unpublish/discover services it's gorgeous but i've  
> found that if a slave, that has published the service via avahi,  
> losts it
> network (i.e. the wifi ap goes out of power), the master still  
> discovering it! and no ItemRemove signal it's raised at all. Is it  
> normal? Am i doing something wrong?
>
> To solve it, i've implemented some kind of "ping" to the slaves  
> service every Xseconds. When a new slave it's discovered, the  
> periodic ping starts.
> When ping it's failing i know there be some problem with networking.
>
> I wonder if avahi itself provides a native workaround to avoid the  
> coding of those nasty "ping" cycles ...

This is normal.. it will disappear after some time.

The instant removal of an advertised service relies on the host  
sending a "gone away" message (more specifically, it updates the TTL  
of its record to expire in I think.. 1 second)

This is because mDNS uses caching.. if it didn't use caching it would  
cause alot more network traffic and would hammer especially wireless  
networks.



Having not really worked with it for a while.. I can't remember all  
the details but I suspect you can change the TTL in the Avahi API call  
to make these timeouts happen a little quicker, but you will increase  
network traffic by doing so.

Really your application should not rely on Avahi for "service  
undiscovery".. it's meant generally for "unreliable service  
discovery".  You are best of actually having some protocol between the  
master and slave and just using avahi for the slave to find the master  
in the first instance.

Regards,
Trent
_______________________________________________
avahi mailing list
avahi@...
http://lists.freedesktop.org/mailman/listinfo/avahi

Re: Published service still browseable in other machines even if network it's down

by José Félix Ontañón :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



2009/11/5 Trent Lloyd <lathiat@...>
Hi Jose,

On 05/11/2009, at 6:35 AM, José Félix Ontañón wrote:

> Hi everyone!
>
> I'm a newbie playing with python-avahi trying to code some kind of
> master-slave application for shutdown every machine at same time.
> When the master it's ordered to shutdown, it sends the signal to the
> slaves. The slaves publish/unpublish the service via avahi, and the
> master
> discover them via ItemNew/ItemRemove signals. Very strait-forward,
> isn't?
>
> The avahi publish/unpublish/discover services it's gorgeous but i've
> found that if a slave, that has published the service via avahi,
> losts it
> network (i.e. the wifi ap goes out of power), the master still
> discovering it! and no ItemRemove signal it's raised at all. Is it
> normal? Am i doing something wrong?
>
> To solve it, i've implemented some kind of "ping" to the slaves
> service every Xseconds. When a new slave it's discovered, the
> periodic ping starts.
> When ping it's failing i know there be some problem with networking.
>
> I wonder if avahi itself provides a native workaround to avoid the
> coding of those nasty "ping" cycles ...

This is normal.. it will disappear after some time.

The instant removal of an advertised service relies on the host
sending a "gone away" message (more specifically, it updates the TTL
of its record to expire in I think.. 1 second)

This is because mDNS uses caching.. if it didn't use caching it would
cause alot more network traffic and would hammer especially wireless
networks.



Having not really worked with it for a while.. I can't remember all
the details but I suspect you can change the TTL in the Avahi API call
to make these timeouts happen a little quicker, but you will increase
network traffic by doing so.

Really your application should not rely on Avahi for "service
undiscovery".. it's meant generally for "unreliable service
discovery".  You are best of actually having some protocol between the
master and slave and just using avahi for the slave to find the master
in the first instance.

Regards,
Trent
_______________________________________________
avahi mailing list
avahi@...
http://lists.freedesktop.org/mailman/listinfo/avahi


Ok, in this case i'll continue with my ping aproximation. It works fairly well.

Thanks Trent.

--
http://nosigasleyendo.blogspot.com

_______________________________________________
avahi mailing list
avahi@...
http://lists.freedesktop.org/mailman/listinfo/avahi

Re: Published service still browseable in other machines even if network it's down

by Bugzilla from robin.perkins@internode.on.net :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On 05/11/2009, at 6:16 PM, José Félix Ontañón wrote:



2009/11/5 Trent Lloyd <lathiat@...>
Hi Jose,

On 05/11/2009, at 6:35 AM, José Félix Ontañón wrote:

> Hi everyone!
>
> I'm a newbie playing with python-avahi trying to code some kind of
> master-slave application for shutdown every machine at same time.
> When the master it's ordered to shutdown, it sends the signal to the
> slaves. The slaves publish/unpublish the service via avahi, and the
> master
> discover them via ItemNew/ItemRemove signals. Very strait-forward,
> isn't?
>
> The avahi publish/unpublish/discover services it's gorgeous but i've
> found that if a slave, that has published the service via avahi,
> losts it
> network (i.e. the wifi ap goes out of power), the master still
> discovering it! and no ItemRemove signal it's raised at all. Is it
> normal? Am i doing something wrong?
>
> To solve it, i've implemented some kind of "ping" to the slaves
> service every Xseconds. When a new slave it's discovered, the
> periodic ping starts.
> When ping it's failing i know there be some problem with networking.
>
> I wonder if avahi itself provides a native workaround to avoid the
> coding of those nasty "ping" cycles ...

This is normal.. it will disappear after some time.

The instant removal of an advertised service relies on the host
sending a "gone away" message (more specifically, it updates the TTL
of its record to expire in I think.. 1 second)

This is because mDNS uses caching.. if it didn't use caching it would
cause alot more network traffic and would hammer especially wireless
networks.



Having not really worked with it for a while.. I can't remember all
the details but I suspect you can change the TTL in the Avahi API call
to make these timeouts happen a little quicker, but you will increase
network traffic by doing so.

Really your application should not rely on Avahi for "service
undiscovery".. it's meant generally for "unreliable service
discovery".  You are best of actually having some protocol between the
master and slave and just using avahi for the slave to find the master
in the first instance.

Regards,
Trent
_______________________________________________
avahi mailing list
avahi@...
http://lists.freedesktop.org/mailman/listinfo/avahi


Ok, in this case i'll continue with my ping aproximation. It works fairly well.

Thanks Trent.

From what I remember reading the docs, what is supposed to happen is when someone goes to try and use a service that is no longer there, it should fail and immediately flush that entry from the cache so that its no longer an option in the user interface.

Rob

_______________________________________________
avahi mailing list
avahi@...
http://lists.freedesktop.org/mailman/listinfo/avahi

Re: Published service still browseable in other machines even if network it's down

by José Félix Ontañón :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



2009/11/5 Robin Perkins <robin.perkins@...>

On 05/11/2009, at 6:16 PM, José Félix Ontañón wrote:



2009/11/5 Trent Lloyd <lathiat@...>
Hi Jose,

On 05/11/2009, at 6:35 AM, José Félix Ontañón wrote:

> Hi everyone!
>
> I'm a newbie playing with python-avahi trying to code some kind of
> master-slave application for shutdown every machine at same time.
> When the master it's ordered to shutdown, it sends the signal to the
> slaves. The slaves publish/unpublish the service via avahi, and the
> master
> discover them via ItemNew/ItemRemove signals. Very strait-forward,
> isn't?
>
> The avahi publish/unpublish/discover services it's gorgeous but i've
> found that if a slave, that has published the service via avahi,
> losts it
> network (i.e. the wifi ap goes out of power), the master still
> discovering it! and no ItemRemove signal it's raised at all. Is it
> normal? Am i doing something wrong?
>
> To solve it, i've implemented some kind of "ping" to the slaves
> service every Xseconds. When a new slave it's discovered, the
> periodic ping starts.
> When ping it's failing i know there be some problem with networking.
>
> I wonder if avahi itself provides a native workaround to avoid the
> coding of those nasty "ping" cycles ...

This is normal.. it will disappear after some time.

The instant removal of an advertised service relies on the host
sending a "gone away" message (more specifically, it updates the TTL
of its record to expire in I think.. 1 second)

This is because mDNS uses caching.. if it didn't use caching it would
cause alot more network traffic and would hammer especially wireless
networks.



Having not really worked with it for a while.. I can't remember all
the details but I suspect you can change the TTL in the Avahi API call
to make these timeouts happen a little quicker, but you will increase
network traffic by doing so.

Really your application should not rely on Avahi for "service
undiscovery".. it's meant generally for "unreliable service
discovery".  You are best of actually having some protocol between the
master and slave and just using avahi for the slave to find the master
in the first instance.

Regards,
Trent
_______________________________________________
avahi mailing list
avahi@...
http://lists.freedesktop.org/mailman/listinfo/avahi


Ok, in this case i'll continue with my ping aproximation. It works fairly well.

Thanks Trent.

From what I remember reading the docs, what is supposed to happen is when someone goes to try and use a service that is no longer there, it should fail and immediately flush that entry from the cache so that its no longer an option in the user interface.

Rob

_______________________________________________
avahi mailing list
avahi@...
http://lists.freedesktop.org/mailman/listinfo/avahi


How do i "try and use" the failing service for flushing the cache entry? I mean, the way i'm doing now it's:

* Slaves publish address and port via avahi
* When the master discover a slave (via avahi), it makes a connection to slave address:port and call some rpc's (via my own xmlrpc implemented service).

Thanks in advance!

--
http://nosigasleyendo.blogspot.com

_______________________________________________
avahi mailing list
avahi@...
http://lists.freedesktop.org/mailman/listinfo/avahi

Re: Published service still browseable in other machines even if network it's down

by Trent Lloyd :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On 05/11/2009, at 8:14 PM, José Félix Ontañón wrote:


From what I remember reading the docs, what is supposed to happen is when someone goes to try and use a service that is no longer there, it should fail and immediately flush that entry from the cache so that its no longer an option in the user interface.

Rob

_______________________________________________
avahi mailing list
avahi@...
http://lists.freedesktop.org/mailman/listinfo/avahi


How do i "try and use" the failing service for flushing the cache entry? I mean, the way i'm doing now it's:

* Slaves publish address and port via avahi
* When the master discover a slave (via avahi), it makes a connection to slave address:port and call some rpc's (via my own xmlrpc implemented service).

Thanks in advance!

Robin is correct.. if you try run a ServiceResolver (rather than the browser), the "POOF" (passive observation of failure) should expire it, i think.

Trent

_______________________________________________
avahi mailing list
avahi@...
http://lists.freedesktop.org/mailman/listinfo/avahi