FlexHub Forum

Error: cannot create new thread

Offline massi

  • FlexHub Ambassador and Forum Stalker
  • *
  • 301
Error: cannot create new thread
« on: May 10, 2011, 09:12:07 »
Hello flip and forum =)
Excuse me for this ...
I need help with a hub that I use as a bridge ...
I have many active ports on it and I think the problem is that ... you carry the error ... if you could kindly fix ... thanks =)
NB. The hub is obviously not part ...
NB. A lot of ports ... i hope this is the problem ...

Code: [Select]
[FI] [-1] Started listening on port: 168. (Regular)
[FI] [-1] Started listening on port: 241. (Regular)
[FI] [-1] Started listening on port: 285. (Regular)
[FI][Listen] Error when running timers: /home/FlexHub_bridge/./core/Hub-Funcs.lua:2953: cannot create new thread
or and ...
An error occured in the application:
ERROR: /home/FlexHub_bridge/./core/Hub-Funcs.lua:1164: cannot create new thread
[FI]
◦Automatic banlist cleanup: No temporary bans expired.

Best Regards
Massimiliano
« Last Edit: May 10, 2011, 09:34:51 by FlipFlop™ »

Offline FlipFlop™

  • FlexHub Developer
  • *****
  • 505
Re: Error: cannot create new thread
« Reply #1 on: May 10, 2011, 09:34:11 »
There are a few reasons for not being able to create more threads:

Out of memory
Check if enough memory is available.

Maximum amount of threads reached (OS limit)
To show the amount of running threads in Linux you can use:
ps axm | wc -l
To show the maximum amount of threads allowed:
cat /proc/sys/kernel/threads-max

To change the maximum amount of threads allowed in Linux you can use for example:
echo 100000 > /proc/sys/kernel/threads-max

ulimit / getrlimit
There is also a limit on the number of processes (and hence threads) that a single user may create, see ulimit/getrlimit for details regarding these limits.
Check the new FlexHubList!           Add awesome statistics like this for your hub!

This post is a natural product. The slight variations in spelling and grammar enhance its individual character and beauty and in no way are to be considered flaws or defects.

Offline massi

  • FlexHub Ambassador and Forum Stalker
  • *
  • 301
Re: Error: cannot create new thread
« Reply #2 on: May 10, 2011, 11:14:34 »
Thanks ... =)
Best Regards ...

Massimiliano.

Offline massi

  • FlexHub Ambassador and Forum Stalker
  • *
  • 301
Re: Error: cannot create new thread
« Reply #3 on: May 11, 2011, 07:32:10 »
Hello.
I tried to analyze and check points as you described, and trying to follow your advice but the problem remains and I could not solve. I look forward to any developments or ideas or any other considerations. I quote here the points with my data.

1 Out of memory
The memory is ok.

2 Maximum amount of threads reached (OS limit)
Currently the value is set to 32240. Even if you set to 100000, nothing changes.

3 ulimit / getrlimit
Currently the value is set to 10240. It seems appropriate.

NB. I think the problem is due to the large number of open ports. In fact, reducing the number of open ports, the problem is resolved and the application, which is the hub part correctly. Otherwise leave it all, the application just does not start and crashes. Unfortunately at the moment I solved by using another hubsoft. I look forward to the resolution of the problem in order to use flexhub.

Best Regards ... Massimiliano =)
« Last Edit: May 11, 2011, 09:26:03 by massi »

Re: Error: cannot create new thread
« Reply #4 on: May 11, 2011, 19:37:21 »
How many ports is "many" ?

Offline massi

  • FlexHub Ambassador and Forum Stalker
  • *
  • 301
Re: Error: cannot create new thread
« Reply #5 on: May 12, 2011, 09:04:28 »
Hi en_dator ... thanks for your support and interest =)

many = 1600

Best Regards
Massimiliano

Offline FlipFlop™

  • FlexHub Developer
  • *****
  • 505
Re: Error: cannot create new thread
« Reply #6 on: May 12, 2011, 09:49:30 »
Instead of running FlexHub (or any other hubsoft) with 1600 ports (...OMG!) it seems in Linux there's a much simpler way, which uses a lot less resources. Just reroute all ports to one port, if 192.168.0.2 is the IP of destination machine:

iptables -t nat -A PREROUTING -p tcp -d 192.168.0.2 --dport 1000:32000 -j DNAT --to 192.168.0.2:8000

That will map all ports in the range 1000-32000 to port 8000. The hub only has to run on port 8000 then.
Check the new FlexHubList!           Add awesome statistics like this for your hub!

This post is a natural product. The slight variations in spelling and grammar enhance its individual character and beauty and in no way are to be considered flaws or defects.