I've seen other people have issues with "Failure: twisted.internet.defer.TimeoutError: in _on_discovery_timeout" in their p2pool log. I had these messages as well. Some people commented on system performance. There may be issues with system performance, but that is definitely not my issue. My server is smokin' with dedicated business network line.
Anyway, it was my iptables config. In addition to the standard bitcoind and p2pool ports, I also had to open up UDP for port 1900, both inbound and outbound. I am still a bit confused as to why port 1900, because I think that port is for uPnP, which I'm not really using and is disabled on my router. If it is for uPnP updates only, then I could have probably just ignored the message anyway. And, the next time I restart the service, I will specifically set uPnP=0 to see if that stops the traffic on port 1900. But I don't want to restart my service just for that. Having port 1900 open does cause a bit more traffic, of course, but it's nothing to worry about unless you are already struggling with system performance.
For your reference, here is my iptables config. I'm running both Bitcoin and Litecoin P2Pool. My Litecoin P2Pool is using p2p port 10333, since 9333 conflicts with bitcoind. My host is also running DNS and NTP, so those ports are open. And I am allowing ping. Most ports are configured with limits as minimal protection against DDoS attacks. I know the limits won't prevent hard-core DDoS attacks.
# Generated by iptables-save v1.4.12 on Fri Sep 12 13:48:46 2014
*filter
:INPUT DROP [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:LOGNDROP - [0:0]
-A INPUT -i lo -j ACCEPT
-A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p icmp -m icmp --icmp-type 8 -m limit --limit 25/min --limit-burst 100 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 22 -m limit --limit 25/min --limit-burst 100 -j ACCEPT
-A INPUT -p udp -m udp --dport 53 -m limit --limit 25/min --limit-burst 100 -j ACCEPT
-A INPUT -p udp -m udp --dport 123 -m limit --limit 25/min --limit-burst 100 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 9327 -m limit --limit 25/min --limit-burst 100 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 9332 -m limit --limit 25/min --limit-burst 100 -j ACCEPT
-A INPUT -p udp -m udp --dport 1900 -m limit --limit 25/min --limit-burst 100 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 9333 -m limit --limit 25/min --limit-burst 100 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 10333 -m limit --limit 25/min --limit-burst 100 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 8333 -m limit --limit 25/min --limit-burst 100 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 9338 -m limit --limit 25/min --limit-burst 100 -j ACCEPT
-A INPUT -j LOGNDROP
-A OUTPUT -o lo -j ACCEPT
-A OUTPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
-A OUTPUT -p icmp -m icmp --icmp-type 0 -m limit --limit 25/min --limit-burst 100 -j ACCEPT
-A OUTPUT -p udp -m udp --dport 53 -m limit --limit 25/min --limit-burst 100 -j ACCEPT
-A OUTPUT -p tcp -m tcp --dport 80 -m limit --limit 25/min --limit-burst 100 -j ACCEPT
-A OUTPUT -p udp -m udp --dport 123 -m limit --limit 25/min --limit-burst 100 -j ACCEPT
-A OUTPUT -p udp -m udp --dport 1900 -m limit --limit 25/min --limit-burst 100 -j ACCEPT
-A OUTPUT -p tcp -m tcp --dport 443 -m limit --limit 25/min --limit-burst 100 -j ACCEPT
-A OUTPUT -p tcp -m tcp --dport 8333 -m limit --limit 25/min --limit-burst 100 -j ACCEPT
-A OUTPUT -p tcp -m tcp --dport 9333 -m limit --limit 25/min --limit-burst 100 -j ACCEPT
-A OUTPUT -p tcp -m tcp --dport 9338 -m limit --limit 25/min --limit-burst 100 -j ACCEPT
-A OUTPUT -p tcp -m tcp --dport 10333 -m limit --limit 25/min --limit-burst 100 -j ACCEPT
-A OUTPUT -j LOGNDROP
-A LOGNDROP -p tcp -m limit --limit 5/min -j LOG --log-prefix "IPTables Denied TCP: " --log-level 7
-A LOGNDROP -p udp -m limit --limit 5/min -j LOG --log-prefix "IPTables Denied UDP: " --log-level 7
-A LOGNDROP -j DROP
COMMIT