Bitcoin Forum
May 10, 2024, 09:34:31 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: [FEATURE REQUEST/BUG REPORT] Limit maximum number of connections to X  (Read 1500 times)
ShadowOfHarbringer (OP)
Legendary
*
Offline Offline

Activity: 1470
Merit: 1005


Bringing Legendary Har® to you since 1952


View Profile
May 24, 2011, 01:13:52 PM
Last edit: May 24, 2011, 02:30:33 PM by ShadowOfHarbringer
 #1

Hello,

I'm having theoretically unimportant but practically problematic small problem with the main bitcoin client: it produces too many connections to external clients and clogs up my bandwidth.

On my 2Mbit broadband home connection, after the client passes 100 connections, most of webpages becomes unreachable. Yeah, i know it is a weak broadband because it becomes clogged easily, but still. (For bittorrent it usually takes about 150 connections to fill the pipe up)

I would like to propose adding "-max-connections=X" command line argument and/or "max-connections=X" directive to bitcoin.conf.

----
EDIT:

It seems that actually it is UPnP support in the client that causes this. So this is more of a [BUG REPORT] than ft. request .

1715333671
Hero Member
*
Offline Offline

Posts: 1715333671

View Profile Personal Message (Offline)

Ignore
1715333671
Reply with quote  #2

1715333671
Report to moderator
1715333671
Hero Member
*
Offline Offline

Posts: 1715333671

View Profile Personal Message (Offline)

Ignore
1715333671
Reply with quote  #2

1715333671
Report to moderator
Each block is stacked on top of the previous one. Adding another block to the top makes all lower blocks more difficult to remove: there is more "weight" above each block. A transaction in a block 6 blocks deep (6 confirmations) will be very difficult to remove.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
sandos
Sr. Member
****
Offline Offline

Activity: 440
Merit: 250


#SWGT CERTIK Audited


View Profile
May 24, 2011, 01:26:23 PM
 #2

I'm pretty sure the client only opens 8 connections normally?

ShadowOfHarbringer (OP)
Legendary
*
Offline Offline

Activity: 1470
Merit: 1005


Bringing Legendary Har® to you since 1952


View Profile
May 24, 2011, 01:27:38 PM
 #3

I'm pretty sure the client only opens 8 connections normally?

Apparently not anymore.

It goes up and up and up - it reached to 117 connections untill i killed it because it filled my bandwidth pipe.
Tested on multiple computers on Linux.

Also, It does so even after all blocks are downloaded.

Garrett Burgwardt
Sr. Member
****
Offline Offline

Activity: 406
Merit: 256


View Profile
May 24, 2011, 01:37:34 PM
 #4

Try running with -noupnp?
ShadowOfHarbringer (OP)
Legendary
*
Offline Offline

Activity: 1470
Merit: 1005


Bringing Legendary Har® to you since 1952


View Profile
May 24, 2011, 01:55:51 PM
 #5

Try running with -noupnp?

UPnP is offline on my router, i have DMZ set up though to the comp with Bitcoin currently.
But why should UPnP affect number of connections with external hosts ?

----
I am trying running bitcoin with "-noupnp" now, i will give you update in few minutes.

----
EDIT:

Yup, you were right -noupnp seems to have fixed it.

So this should be more like [BUG REPORT] than [FEATURE REQUEST].

Pieter Wuille
Legendary
*
qt
Offline Offline

Activity: 1072
Merit: 1174


View Profile WWW
May 24, 2011, 02:00:21 PM
 #6

It will not make more than 8 outgoing connections, but unless you supply -nolisten, it will listen for incoming connections independently. Maybe you just want to use -nolisten?

I do Bitcoin stuff.
ShadowOfHarbringer (OP)
Legendary
*
Offline Offline

Activity: 1470
Merit: 1005


Bringing Legendary Har® to you since 1952


View Profile
May 24, 2011, 02:16:46 PM
 #7

It will not make more than 8 outgoing connections, but unless you supply -nolisten, it will listen for incoming connections independently. Maybe you just want to use -nolisten?

But I do want it to listen.

Without listening it is hard/slow for the client to make many external connections. With listening it is instant.

But the actual problem is broken UPnP support, so the matter is clear now. The older versions weren't affected because there was no UPnP at all in them.

Matt Corallo
Hero Member
*****
expert
Offline Offline

Activity: 755
Merit: 515


View Profile
May 24, 2011, 03:05:52 PM
 #8

Wow, wow wow.  Hold on there.  UPnP has nothing to do with this.  First of all, to answer your original question, you can simply use -maxconnections=XX to limit max connections (default is 125), this has been in the client for quite some time. 
-noupnp actually ends up working the same way as -nolisten in that with UPnP enabled (which it is not, by default, unless you built yourself with USE_UPNP=1) your router will forward your connections properly allowing you to get more than 8 by accepting incoming connections.  -nolisten will end up doing the same thing by rejecting incoming connections.  What you should do is leave UPnP on (and/or forward the ports manually) and limit your connections to something that works for you, helping the network which has recently become very hard to bootstrap and make initial connections due to the massive number of people running nodes which do not accept incoming connections and/or do not have their ports forwarded properly.

Bitcoin Core, rust-lightning, http://bitcoinfibre.org etc.
PGP ID: 07DF 3E57 A548 CCFB 7530  7091 89BB B866 3E2E65CE
Garrett Burgwardt
Sr. Member
****
Offline Offline

Activity: 406
Merit: 256


View Profile
May 24, 2011, 03:08:59 PM
 #9

Wow, wow wow.  Hold on there.  UPnP has nothing to do with this.  First of all, to answer your original question, you can simply use -maxconnections=XX to limit max connections (default is 125), this has been in the client for quite some time. 
-noupnp actually ends up working the same way as -nolisten in that with UPnP enabled (which it is not, by default, unless you built yourself with USE_UPNP=1) your router will forward your connections properly allowing you to get more than 8 by accepting incoming connections.  -nolisten will end up doing the same thing by rejecting incoming connections.  What you should do is leave UPnP on (and/or forward the ports manually) and limit your connections to something that works for you, helping the network which has recently become very hard to bootstrap and make initial connections due to the massive number of people running nodes which do not accept incoming connections and/or do not have their ports forwarded properly.

Ah, my mistake then Smiley I suggested that as a guess, didn't mean to pose as someone who knew what they were talking about Tongue
ShadowOfHarbringer (OP)
Legendary
*
Offline Offline

Activity: 1470
Merit: 1005


Bringing Legendary Har® to you since 1952


View Profile
May 24, 2011, 03:44:09 PM
 #10

Wow, wow wow.  Hold on there.  UPnP has nothing to do with this.  First of all, to answer your original question, you can simply use -maxconnections=XX to limit max connections (default is 125), this has been in the client for quite some time. 

Hmmm...

Too bad that this doesn't show up when i do # bitcoin --help.
Otherwise i wouldn't start this topic.

-noupnp actually ends up working the same way as -nolisten in that with UPnP enabled (which it is not, by default, unless you built yourself with USE_UPNP=1)

Weird. I'm using the pre-built bitcoin binary version 0.3.20. Is it built with UPnP support then ?
If not, then how disabling UPnP could have fixed it ?

your router will forward your connections properly allowing you to get more than 8 by accepting incoming connections.  -nolisten will end up doing the same thing by rejecting incoming connections. 

Why should disabling UPnP make the client reject connections ? This is weird. Shouldn't this be considered a bug ?

What you should do is leave UPnP on (and/or forward the ports manually)

I have forwarded the ports manually... I said i have DMZ set up.
Also, UPnP is disabled on my router anyway (i consider it to be unnecessary security risk), so enabling or disabling UPnP should have no effect whatsoever.

Matt Corallo
Hero Member
*****
expert
Offline Offline

Activity: 755
Merit: 515


View Profile
May 24, 2011, 03:48:51 PM
 #11

Weird. I'm using the pre-built bitcoin binary version 0.3.20. Is it built with UPnP support then ?
If not, then how disabling UPnP could have fixed it ?
0.3.20 doesn't have UPnP support at all.  -noupnp does...nothing at all in 0.3.20.
That said, in recent time, bootstrapping and initial connections on the network have become very, very slow and random , which is probably exactly what you are seeing.

Why should disabling UPnP make the client reject connections ? This is weird. Shouldn't this be considered a bug ?
Thats not about the client, that is about the router.  If UPnP is on (on Bitcoin and your router), it will be possible to get incoming connections, whereas if its off (and you don't have your ports manually forwarded) there is no way for any application to receive incoming connections.

I have forwarded the ports manually... I said i have DMZ set up.
Also, UPnP is disabled on my router anyway (i consider it to be unnecessary security risk), so enabling or disabling UPnP should have no effect whatsoever.
Yep, as does using UPnP options in 0.3.20 Wink.

Bitcoin Core, rust-lightning, http://bitcoinfibre.org etc.
PGP ID: 07DF 3E57 A548 CCFB 7530  7091 89BB B866 3E2E65CE
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!