View previous topic :: View next topic |
Author |
Message |
GurliGebis
Joined: 16 Apr 2009 Posts: 35
|
Posted: Mon Jun 08, 2009 12:32 pm Post subject: |
|
|
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 |
|
|
GurliGebis
Joined: 16 Apr 2009 Posts: 35
|
Posted: Tue Jun 09, 2009 5:14 pm Post subject: |
|
|
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 |
|
|
GurliGebis
Joined: 16 Apr 2009 Posts: 35
|
Posted: Sun Jun 21, 2009 11:57 am Post subject: |
|
|
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 |
|
|
Colt45ws
Joined: 25 Jul 2009 Posts: 5
|
Posted: Sat Jul 25, 2009 8:01 pm Post subject: |
|
|
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 |
|
|
miniupnp Site Admin
Joined: 14 Apr 2007 Posts: 1589
|
Posted: Mon Jul 27, 2009 9:34 am Post subject: |
|
|
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 ...
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 |
|
|
miniupnp Site Admin
Joined: 14 Apr 2007 Posts: 1589
|
Posted: Mon Jul 27, 2009 9:39 am Post subject: |
|
|
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 |
|
|
GurliGebis
Joined: 16 Apr 2009 Posts: 35
|
Posted: Mon Jul 27, 2009 9:54 am Post subject: |
|
|
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 ...
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 |
|
|
Colt45ws
Joined: 25 Jul 2009 Posts: 5
|
|
Back to top |
|
|
GurliGebis
Joined: 16 Apr 2009 Posts: 35
|
Posted: Tue Aug 04, 2009 1:33 pm Post subject: |
|
|
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 |
|
|
Colt45ws
Joined: 25 Jul 2009 Posts: 5
|
Posted: Thu Aug 06, 2009 7:06 pm Post subject: |
|
|
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 |
|
|
GurliGebis
Joined: 16 Apr 2009 Posts: 35
|
Posted: Thu Aug 06, 2009 7:47 pm Post subject: |
|
|
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 |
|
|
miguel
Joined: 21 Sep 2009 Posts: 3
|
Posted: Mon Sep 21, 2009 8:12 am Post subject: |
|
|
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 |
|
|
miniupnp Site Admin
Joined: 14 Apr 2007 Posts: 1589
|
Posted: Mon Sep 21, 2009 9:39 am Post subject: |
|
|
thanks for the patch ! I hope it works with all Iptables versions _________________ Main miniUPnP author.
https://miniupnp.tuxfamily.org/ |
|
Back to top |
|
|
Colt45ws
Joined: 25 Jul 2009 Posts: 5
|
Posted: Mon Sep 21, 2009 10:19 am Post subject: |
|
|
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 |
|
|
GurliGebis
Joined: 16 Apr 2009 Posts: 35
|
Posted: Mon Sep 21, 2009 10:25 am Post subject: |
|
|
Not bad, I'll create an updated ebuild for gentoo later this afternoon (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 |
|
|
|