Bug #12

threading fails

Added by marder - over 3 years ago. Updated about 3 years ago.

Status:Closed Start date:
Priority:Urgent Due date:
Assignee:Lukas Rist % Done:

0%

Category:Glastopf Spent time: -
Target version:Glastopf unstable code freeze
Resolution:fixed

Description

----------------------------------------
Exception happened during processing of request from ('89.218.85.18', 60966)
Traceback (most recent call last):
  File "/usr/lib/python2.5/SocketServer.py", line 222, in handle_request
    self.process_request(request, client_address)
  File "/usr/lib/python2.5/SocketServer.py", line 477, in process_request
    t.start()
  File "/usr/lib/python2.5/threading.py", line 440, in start
    _start_new_thread(self.+bootstrap, ())
error: can't start new thread
----------------------------------------
----------------------------------------
Exception happened during processing of request from ('91.52.191.193', 7067)
Traceback (most recent call last):
  File "/usr/lib/python2.5/SocketServer.py", line 222, in handle_request
    self.process_request(request, client_address)
  File "/usr/lib/python2.5/SocketServer.py", line 477, in process_request
    t.start()
  File "/usr/lib/python2.5/threading.py", line 440, in start
    _start_new_thread(self.+bootstrap, ())
error: can't start new thread
----------------------------------------
----------------------------------------
Exception happened during processing of request from ('66.160.185.20', 59829)
Traceback (most recent call last):
  File "/usr/lib/python2.5/SocketServer.py", line 222, in handle_request
    self.process_request(request, client_address)
  File "/usr/lib/python2.5/SocketServer.py", line 477, in process_request
    t.start()
  File "/usr/lib/python2.5/threading.py", line 440, in start
    _start_new_thread(self.+bootstrap, ())
error: can't start new thread
----------------------------------------

no need to give more description.
this IS critically error.
It's second time i got it; I updated the threading.py, but the error now occurs again.
I have no idea where to search for errors,
due to the python2.5-dbg does not like the mysql implementation.

greets,madda

History

Updated by marder - over 3 years ago

Replying to marder:

> ----------------------------------------
> Exception happened during processing of request from ('89.218.85.18', 60966)
> Traceback (most recent call last):
>   File "/usr/lib/python2.5/SocketServer.py", line 222, in handle_request
>     self.process_request(request, client_address)
>   File "/usr/lib/python2.5/SocketServer.py", line 477, in process_request
>     t.start()
>   File "/usr/lib/python2.5/threading.py", line 440, in start
>     _start_new_thread(self.+bootstrap, ())
> error: can't start new thread
> ----------------------------------------
> ----------------------------------------
> Exception happened during processing of request from ('91.52.191.193', 7067)
> Traceback (most recent call last):
>   File "/usr/lib/python2.5/SocketServer.py", line 222, in handle_request
>     self.process_request(request, client_address)
>   File "/usr/lib/python2.5/SocketServer.py", line 477, in process_request
>     t.start()
>   File "/usr/lib/python2.5/threading.py", line 440, in start
>     _start_new_thread(self.+bootstrap, ())
> error: can't start new thread
> ----------------------------------------
> ----------------------------------------
> Exception happened during processing of request from ('66.160.185.20', 59829)
> Traceback (most recent call last):
>   File "/usr/lib/python2.5/SocketServer.py", line 222, in handle_request
>     self.process_request(request, client_address)
>   File "/usr/lib/python2.5/SocketServer.py", line 477, in process_request
>     t.start()
>   File "/usr/lib/python2.5/threading.py", line 440, in start
>     _start_new_thread(self.+bootstrap, ())
> error: can't start new thread
> ----------------------------------------

no need to give more description.
this IS critically error.
It's second time i got it; I updated the threading.py, but the error now occurs again.
I have no idea where to search for errors,
due to the python2.5-dbg does not like the mysql implementation.

greets,madda

enable debug for threading:

in threading.py, line 33, set

_VERBOSE = True

Updated by Lukas Rist over 3 years ago

  • Status changed from New to Assigned

Maybe maximum number of threads reached?

Updated by marder - over 3 years ago

here it is:

----------------------------------------
Exception happened during processing of request from ('218.234.21.131', 33995)
Traceback (most recent call last):
  File "/usr/lib/python2.5/SocketServer.py", line 222, in handle_request
    self.process_request(request, client_address)
  File "/usr/lib/python2.5/SocketServer.py", line 477, in process_request
    t.start()
  File "/usr/lib/python2.5/threading.py", line 440, in start
    _start_new_thread(self.+bootstrap, ())
error: can't start new thread
----------------------------------------
[[MainThread]]: <Thread(Thread-88327, initial)>.start(): starting thread
----------------------------------------
Exception happened during processing of request from ('202.60.67.10', 44064)
Traceback (most recent call last):
  File "/usr/lib/python2.5/SocketServer.py", line 222, in handle_request
    self.process_request(request, client_address)
  File "/usr/lib/python2.5/SocketServer.py", line 477, in process_request
    t.start()
  File "/usr/lib/python2.5/threading.py", line 440, in start
    _start_new_thread(self.+bootstrap, ())
error: can't start new thread
----------------------------------------


i'm goin to restart the py now,
just guessing, do we need to unlock the threads?

Updated by Manfred Schilling over 3 years ago

Replying to [comment:2 glaslos]:

Maybe maximum number of threads reached?

yepp, but what makes it happen ?

Updated by Manfred Schilling over 3 years ago

ok.

from what i saw,

i have extremely large amount from single IPs,

^C received, shutting down server
The program finished and will be restarted
> /home/rfih/rfih/webserver.py(4)<module>()
-> from [[BaseHTTPServer]] import HTTPServer, [[BaseHTTPRequestHandler]]
(Pdb) Traceback (most recent call last):
  File "/usr/lib/python2.5/pdb.py", line 1213, in main
    pdb._runscript(mainpyfile)
  File "/usr/lib/python2.5/pdb.py", line 1138, in _runscript
    self.run(statement, globals=globals_, locals=locals_)
  File "/usr/lib/python2.5/bdb.py", line 366, in run
    exec cmd in globals, locals
  File "<string>", line 1, in <module>
  File "webserver.py", line 4, in <module>
    from [[BaseHTTPServer]] import HTTPServer, [[BaseHTTPRequestHandler]]
  File "webserver.py", line 4, in <module>
    from [[BaseHTTPServer]] import HTTPServer, [[BaseHTTPRequestHandler]]
  File "/usr/lib/python2.5/bdb.py", line 48, in trace_dispatch
    return self.dispatch_line(frame)
  File "/usr/lib/python2.5/bdb.py", line 66, in dispatch_line
    self.user_line(frame)
  File "/usr/lib/python2.5/pdb.py", line 144, in user_line
    self.interaction(frame, None)
  File "/usr/lib/python2.5/pdb.py", line 187, in interaction
    self.cmdloop()
  File "/usr/lib/python2.5/cmd.py", line 130, in cmdloop
    line = raw_input(self.prompt)
[[KeyboardInterrupt]]
Uncaught exception. Entering post mortem debugging
Running 'cont' or 'step' will restart the program
> /usr/lib/python2.5/cmd.py(151)cmdloop()
-> pass
(Pdb) http://br.geocities.com/kynhow/pbot3.txt?
http://br.geocities.com/kynhow/pbot3.txt?
http://br.geocities.com/kynhow/pbot3.txt?
Data written into Database
Data written into Database
----------------------------------------
Exception happened during processing of request from ('81.0.136.101', 53927)
Traceback (most recent call last):
  File "/usr/lib/python2.5/SocketServer.py", line 464, in process_request_thread
    self.finish_request(request, client_address)
  File "/usr/lib/python2.5/SocketServer.py", line 254, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/lib/python2.5/SocketServer.py", line 522, in +init+
    self.handle()
  File "/usr/lib/python2.5/BaseHTTPServer.py", line 316, in handle
    self.handle_one_request()
  File "/usr/lib/python2.5/BaseHTTPServer.py", line 310, in handle_one_request
    method()
  File "webserver.py", line 25, in do_GET
    id = opener.openurl(url,self) # opens the url
  File "/home/rfih/rfih/opener.py", line 21, in openurl
    self.wfile.write(f.read())
  File "/usr/lib/python2.5/socket.py", line 274, in write
    self.flush()
  File "/usr/lib/python2.5/socket.py", line 261, in flush
    self._sock.sendall(buffer)
error: (32, 'Broken pipe')
----------------------------------------
----------------------------------------
Exception happened during processing of request from ('81.0.136.101', 53928)
Traceback (most recent call last):
  File "/usr/lib/python2.5/SocketServer.py", line 464, in process_request_thread
    self.finish_request(request, client_address)
  File "/usr/lib/python2.5/SocketServer.py", line 254, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/lib/python2.5/SocketServer.py", line 522, in +init+
    self.handle()
  File "/usr/lib/python2.5/BaseHTTPServer.py", line 316, in handle
    self.handle_one_request()
  File "/usr/lib/python2.5/BaseHTTPServer.py", line 310, in handle_one_request
    method()
  File "webserver.py", line 25, in do_GET
    id = opener.openurl(url,self) # opens the url
  File "/home/rfih/rfih/opener.py", line 21, in openurl
    self.wfile.write(f.read())
  File "/usr/lib/python2.5/socket.py", line 274, in write
    self.flush()
  File "/usr/lib/python2.5/socket.py", line 261, in flush
    self._sock.sendall(buffer)
error: (32, 'Broken pipe')
----------------------------------------
File 06ee64e0f86ca97785154e115a24f4e2 already exists.
File 06ee64e0f86ca97785154e115a24f4e2 already exists.
File 06ee64e0f86ca97785154e115a24f4e2 already exists.
Traceback (most recent call last):
  File "/usr/lib/python2.5/runpy.py", line 95, in run_module
    filename, loader, alter_sys)
  File "/usr/lib/python2.5/runpy.py", line 52, in _run_module_code
    mod_name, mod_fname, mod_loader)
  File "/usr/lib/python2.5/runpy.py", line 32, in _run_code
    exec code in run_globals
  File "/usr/lib/python2.5/pdb.py", line 1234, in <module>
    main()
  File "/usr/lib/python2.5/pdb.py", line 1228, in main
    pdb.interaction(t.tb_frame,t)
  File "/usr/lib/python2.5/pdb.py", line 187, in interaction
    self.cmdloop()
  File "/usr/lib/python2.5/cmd.py", line 130, in cmdloop
    line = raw_input(self.prompt)
[[KeyboardInterrupt]]
File 06ee64e0f86ca97785154e115a24f4e2 already exists.
File 06ee64e0f86ca97785154e115a24f4e2 already exists.
File 06ee64e0f86ca97785154e115a24f4e2 already exists.
File 06ee64e0f86ca97785154e115a24f4e2 already exists.
File 06ee64e0f86ca97785154e115a24f4e2 already exists.
File 06ee64e0f86ca97785154e115a24f4e2 already exists.
Data written into Database
Already in Database
Already in Database
Already in Database
Already in Database
Data written into Database
Already in Database
Already in Database
Data written into Database
Already in Database
Data written into Database
Data written into Database
Data written into Database
Data written into Database
Data written into Database
Data written into Database
Data written into Database
Data written into Database
Exception exceptions.KeyboardInterrupt in <module 'threading' from '/usr/lib/python2.5/threading.pyc'> ignored

i'd ran this via "python2.5 -m pdb webserver.py".

now changed the threading.py, and started with additional parameter

preparing a "hammering script" and will do some tests.
If there's any usefull result, i will set up the glaspot at another machine on uncommonly used port to do more penetrating and toensure that there's no third party ....

all in all, at this moment, it looks like the last # in documentation for threading.py... tbc

Updated by Manfred Schilling over 3 years ago

i stopped to run pdb at this, cos it's very easy to reproduce the fault.
i used simple sh script to provocate the py goin out of max open files(guessing)

while true
do
nc -vv $honepot_IP 80 < attack_script &
done

attack_script:
GET /die/you?maggot=http://google.com/ HTTP/1.0

omg! i had forgotten to make it possible to break, i'm not counting the connections nor do i limiting anything...

thats a lost:lost situation, for honey and may be for attacker...
tbc

Updated by Manfred Schilling over 3 years ago

thanks for your hints, glaslos.

I'm running the version from svn:trunk with a little change,

and secondary another machine for the unstable using an uncommly used port.

btw. i saw that threading error a lot of times while googl'n',

a p2p programm for example...

Updated by Manfred Schilling about 3 years ago

please have a look onto #37.

I added activeCount and enumeration (on stopping the webserver.py).

Using a second shell you can "netstat -anp|grep pyth"

if last threading.activeCount was 6, but we should have 2,

you would see 4 connection beeing still alive.

Maybe that helps to bring light into the problem.

Updated by Manfred Schilling about 3 years ago

  • Status changed from Assigned to Closed
  • Resolution set to fixed

you already fixed it, actual testing works fine (closing dumb connections).

Also available in: Atom PDF