miniupnp.tuxfamily.org Forum Index miniupnp.tuxfamily.org
The forum about miniupnp and libnatpmp
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Wierd bug that makes ~9300 entrys in log file per second
Goto page Previous  1, 2, 3  Next
 
Post new topic   Reply to topic    miniupnp.tuxfamily.org Forum Index -> miniupnpd Bugs
View previous topic :: View next topic  
Author Message
GurliGebis



Joined: 16 Apr 2009
Posts: 35

PostPosted: Mon Jun 08, 2009 12:32 pm    Post subject: Reply with quote

The patch is just a diff between 1.3 and 20090516.

Does the code open a handle for each connection, and somehow forgets to close it again, so it is taking all the handle avaliable in the system??
Back to top
View user's profile Send private message
GurliGebis



Joined: 16 Apr 2009
Posts: 35

PostPosted: Tue Jun 09, 2009 5:14 pm    Post subject: Reply with quote

I'm no expert on C, but could it be, that utorrent doesn't close it's http connection completly (or maybe not at all), so the socket is kept open?
If e->state for the connection never gets a disconnected value, it is never cleaned up.

could you try and add some debug printing code to where it checks what e->state is (since I don't know how it should be done correctly (not knowing about C really)), so the logs will tell what state they are in, since they don't get cleaned up.
Since it seems to be one program causing it, it might be because it does something different from every other upnp client.
Back to top
View user's profile Send private message
GurliGebis



Joined: 16 Apr 2009
Posts: 35

PostPosted: Sun Jun 21, 2009 11:57 am    Post subject: Reply with quote

Any news on this, so it can be fixed?

The problems seems to be that something prevents it from closing its handles, so it keeps them open untill the system runs out of avaliable handles.
Back to top
View user's profile Send private message
Colt45ws



Joined: 25 Jul 2009
Posts: 5

PostPosted: Sat Jul 25, 2009 8:01 pm    Post subject: Reply with quote

GurliGebis wrote:
Any news on this, so it can be fixed?

The problems seems to be that something prevents it from closing its handles, so it keeps them open untill the system runs out of avaliable handles.

Bump. I am getting this as well. Very annoying when it fills my 11GB partition.
It seems to be opening two of these handles for every port request.
I am seeing 4 port openings since it opened and 8 of these strange handles.
Weather that is only matching or all is a different question.
_________________
Gentoo-based Router (Sarah)
Back to top
View user's profile Send private message
miniupnp
Site Admin


Joined: 14 Apr 2007
Posts: 1589

PostPosted: Mon Jul 27, 2009 9:34 am    Post subject: Reply with quote

SoLoR wrote:
miniupnp wrote:
could someone send me the files miniupnpd-20090516.diff miniupnpd-1.3-iptables_path.diff miniupnpd-1.3-Makefile_fix.diff (or tell me where they can be downloaded).
I think the problem may be in one of thoses.


here

file is not available anymore ... Sad

It's difficult for me to provide any help for this bug as I'm not using gentoo and the problem never happened elsewhere...
_________________
Main miniUPnP author.
https://miniupnp.tuxfamily.org/
Back to top
View user's profile Send private message Visit poster's website
miniupnp
Site Admin


Joined: 14 Apr 2007
Posts: 1589

PostPosted: Mon Jul 27, 2009 9:39 am    Post subject: Reply with quote

miniupnp wrote:
very strange, nobody else reported such problem.
you could add code to stop miniupnpd after accept() when it happens.

to implement this, edit miniupnpd.c, find the code:
Code:
shttp = accept(shttpl, (struct sockaddr *)&clientname, &clientnamelen);
         if(shttp<0)
         {
            syslog(LOG_ERR, "accept(http): %m");
         }

and replace by :
Code:
shttp = accept(shttpl, (struct sockaddr *)&clientname, &clientnamelen);
         if(shttp<0)
         {
            syslog(LOG_ERR, "accept(http): %m");
            if(errno == EMFILE || errno == ENFILE)
                exit(42);
         }

_________________
Main miniUPnP author.
https://miniupnp.tuxfamily.org/
Back to top
View user's profile Send private message Visit poster's website
GurliGebis



Joined: 16 Apr 2009
Posts: 35

PostPosted: Mon Jul 27, 2009 9:54 am    Post subject: Reply with quote

miniupnp wrote:
SoLoR wrote:
miniupnp wrote:
could someone send me the files miniupnpd-20090516.diff miniupnpd-1.3-iptables_path.diff miniupnpd-1.3-Makefile_fix.diff (or tell me where they can be downloaded).
I think the problem may be in one of thoses.


here

file is not available anymore ... Sad

It's difficult for me to provide any help for this bug as I'm not using gentoo and the problem never happened elsewhere...


Hey,

The files is avaliable here: http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-misc/miniupnpd/files/

The problem seems to be related to Gentoo, but I have no idea why (the ebuild doesn't do anything specific that should cause it to break).

You can have a look at it here and see, if there is anything that looks weird, that might be causing this: http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-misc/miniupnpd/miniupnpd-1.3-r1.ebuild?rev=1.1&view=markup

Best regards,
GurliGebis
Back to top
View user's profile Send private message
Colt45ws



Joined: 25 Jul 2009
Posts: 5

PostPosted: Tue Aug 04, 2009 12:12 pm    Post subject: Reply with quote

I posted a bug on this over at Gentoo bugs.
http://bugs.gentoo.org/show_bug.cgi?id=280137
_________________
Gentoo-based Router (Sarah)
Back to top
View user's profile Send private message
GurliGebis



Joined: 16 Apr 2009
Posts: 35

PostPosted: Tue Aug 04, 2009 1:33 pm    Post subject: Reply with quote

Colt45ws wrote:
I posted a bug on this over at Gentoo bugs.
http://bugs.gentoo.org/show_bug.cgi?id=280137


I've added some input to the bug, but for now I haven't got much to go on.

We need a debug build that spams the log with info for every check the closing function does, so we can figure out why it never frees the handles.

wrt. the replacing miniupnp mentioned - that won't help finding the problem, only make sure it exists when the system runs out of handles (which won't help find the problem).
Back to top
View user's profile Send private message
Colt45ws



Joined: 25 Jul 2009
Posts: 5

PostPosted: Thu Aug 06, 2009 7:06 pm    Post subject: Reply with quote

I didnt know you are a Gentoo Dev.
I agree, need a debug option. But we don't necessarily have to spam the log, just show it all in foreground with -d.
_________________
Gentoo-based Router (Sarah)
Back to top
View user's profile Send private message
GurliGebis



Joined: 16 Apr 2009
Posts: 35

PostPosted: Thu Aug 06, 2009 7:47 pm    Post subject: Reply with quote

Colt45ws wrote:
I didnt know you are a Gentoo Dev.
I agree, need a debug option. But we don't necessarily have to spam the log, just show it all in foreground with -d.


In this case logging for when it checks for the state of the connection is enough to see why the problem thinks it shouldn't close the handle.
Back to top
View user's profile Send private message
miguel



Joined: 21 Sep 2009
Posts: 3

PostPosted: Mon Sep 21, 2009 8:12 am    Post subject: Reply with quote

Hello,

I've got same issue here using Openwrt firmware,
i.e. got many open raw sockets.

Using the following patch fix the problem for me.
looks a miss use of libiptc in netfilter/iptcrdr.c. Some handles never free.

Miguel

Code:

--- a/netfilter/iptcrdr.c
+++ b/netfilter/iptcrdr.c
@@ -415,11 +415,21 @@ delete_redirect_and_filter_rules(unsigne
                if(h)
                {
                        r = delete_rule_and_commit(index, h, miniupnpd_nat_chain, "delete_redirect_rule");
+#ifdef IPTABLES_143
+                       iptc_free(h);
+#else
+                       iptc_free(&h);
+#endif
                }
                h = iptc_init("filter");
                if(h && (r == 0))
                {
                        r = delete_rule_and_commit(index, h, miniupnpd_forward_chain, "delete_filter_rule");
+#ifdef IPTABLES_143
+                       iptc_free(h);
+#else
+                       iptc_free(&h);
+#endif
                }
        }
        del_redirect_desc(eport, proto);
@@ -509,6 +519,11 @@ iptc_init_verify_and_append(const char *
        {
                syslog(LOG_ERR, "%s : iptc_is_chain() error : %s\n",
                       logcaller, iptc_strerror(errno));
+#ifdef IPTABLES_143
+               iptc_free(h);
+#else
+               iptc_free(&h);
+#endif
                return -1;
        }
 #ifdef IPTABLES_143
@@ -519,6 +534,11 @@ iptc_init_verify_and_append(const char *
        {
                syslog(LOG_ERR, "%s : iptc_append_entry() error : %s\n",
                       logcaller, iptc_strerror(errno));
+#ifdef IPTABLES_143
+               iptc_free(h);
+#else
+               iptc_free(&h);
+#endif
                return -1;
        }
 #ifdef IPTABLES_143
         @@ -529,8 +549,18 @@ iptc_init_verify_and_append(const char *
        {
                syslog(LOG_ERR, "%s : iptc_commit() error : %s\n",
                       logcaller, iptc_strerror(errno));
+#ifdef IPTABLES_143
+               iptc_free(h);
+#else
+               iptc_free(&h);
+#endif
                return -1;
        }
+#ifdef IPTABLES_143
+       iptc_free(h);
+#else
+       iptc_free(&h);
+#endif
        return 0;
 }
                                                                         
Back to top
View user's profile Send private message
miniupnp
Site Admin


Joined: 14 Apr 2007
Posts: 1589

PostPosted: Mon Sep 21, 2009 9:39 am    Post subject: Reply with quote

thanks for the patch ! I hope it works with all Iptables versions
_________________
Main miniUPnP author.
https://miniupnp.tuxfamily.org/
Back to top
View user's profile Send private message Visit poster's website
Colt45ws



Joined: 25 Jul 2009
Posts: 5

PostPosted: Mon Sep 21, 2009 10:19 am    Post subject: Reply with quote

Woot! Seems to work. I have no RAW sockets open! I made a modified ebuild along with a patch for gentoo and it works perfectly! Did you make this patch miguel?
_________________
Gentoo-based Router (Sarah)
Back to top
View user's profile Send private message
GurliGebis



Joined: 16 Apr 2009
Posts: 35

PostPosted: Mon Sep 21, 2009 10:25 am    Post subject: Reply with quote

Not bad, I'll create an updated ebuild for gentoo later this afternoon Smile (If I can get my kernel headers to behave, so I can compile and test myself)

Any chance on a new release soon containing this fix?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    miniupnp.tuxfamily.org Forum Index -> miniupnpd Bugs All times are GMT
Goto page Previous  1, 2, 3  Next
Page 2 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP
© 2007 Thomas Bernard, author of MiniUPNP.