cubicweb #343320 Logging out while deleting a CWUser blocks the cw server [resolved]

We could manage to show up a bug that completely blocks the cw server by filling up the connection pool. To reproduce it, please use this shell script:

There will be no response to the last wget request:

wget --keep-session-cookies --save-cookies /tmp/cookies_test 'http://localhost:8080/login?__login=admin&__password=admin'
wget --keep-session-cookies --load-cookies /tmp/cookies_test 'http://localhost:8080/edit?eid=1747&__action_delete=yes&__type:1747=CWUser' &
wget --keep-session-cookies --load-cookies /tmp/cookies_test 'http://localhost:8080/logout'
wget --keep-session-cookies --save-cookies /tmp/cookies_test 'http://localhost:8080/login?__login=admin&__password=admin'
wget --keep-session-cookies --load-cookies /tmp/cookies_test 'http://localhost:8080/edit?eid=1747&__action_delete=yes&__type:1747=CWUser'

Where

eid = 1747 is an existing CWUser.
localhost:8080 is the cubicweb base url

Note that the CWUser delete hooks are called after the admin logout occurs. The following exception is raised

2009/05/19 10:39 +0200 [HTTPChannel,27,127.0.0.1] 2009-05-19 10:39:50 - (cubicweb.hooksmanager) INFO: calling hooks for event after_delete_entity (CWUser)
2009/05/19 10:39 +0200 [HTTPChannel,27,127.0.0.1] 2009-05-19 10:39:50 - (cubicweb.web) ERROR: ProgrammingError('Connection is already closed',)
2009/05/19 10:39 +0200 [HTTPChannel,27,127.0.0.1] Traceback (most recent call last):
2009/05/19 10:39 +0200 [HTTPChannel,27,127.0.0.1]   File "/home/fafa/2wsp/cubicweb/web/application.py", line 332, in main_publish
2009/05/19 10:39 +0200 [HTTPChannel,27,127.0.0.1]     req.cnx.commit()
2009/05/19 10:39 +0200 [HTTPChannel,27,127.0.0.1]   File "/home/fafa/2wsp/cubicweb/dbapi.py", line 473, in commit
2009/05/19 10:39 +0200 [HTTPChannel,27,127.0.0.1]     raise ProgrammingError('Connection is already closed')
2009/05/19 10:39 +0200 [HTTPChannel,27,127.0.0.1] ProgrammingError: Connection is already closed

In a second time, the entity 1747 still appear in the CWUser list of the management interface. But it is impossible to delete or to modify it, the server does not respond to any modify or delete request. The server can then easily be blocked, by using all the connection pools available.

priorityimportant
typebug
done in3.2.1
load left0.000
closed by<not specified>