Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

httpd threads max out #12

Open
FuhuXia opened this issue Dec 3, 2014 · 8 comments
Open

httpd threads max out #12

FuhuXia opened this issue Dec 3, 2014 · 8 comments

Comments

@FuhuXia
Copy link
Contributor

FuhuXia commented Dec 3, 2014

Some recent change brought in this bug. We observed that after a fresh Apache start, the httpd process count will keep increasing, and max out after a few hours. At this point any new api call such as /api/3/action/package_search will cause 500 error with apache error:
Error - <class 'thread.error'>: can't start new thread

Here is the detailed error info.

...
Module ckanext.googleanalytics.controller:65 in __init__
<<              t = AnalyticsPostThread(self.analytics_queue)
                   t.setDaemon(True)
                   t.start()

           def _post_analytics(
>>  t.start()
Module threading:474 in start
<<          _active_limbo_lock.release()
               try:
                   _start_new_thread(self.__bootstrap, ())
               except Exception:
                   with _active_limbo_lock:
>>  _start_new_thread(self.__bootstrap, ())
error: can't start new thread
@acorbi
Copy link

acorbi commented Jan 21, 2015

Run into a similar situation while runing a script that imports a massive number of datasets into ckan using /api/3/action/package_create and /api/3/action/package_update API methods. Here the error log ( convert to html for proper readability): http://pastebin.com/ZWUmCxTe

@rossjones
Copy link
Contributor

Probably the code at https://github.com/ckan/ckanext-googleanalytics/blob/master/ckanext/googleanalytics/controller.py#L60-L65 creating some threads each time a controller is created.

@CarlQLange
Copy link

What's the story with this issue? Is it still a problem? Will it affect all users?

@rossjones
Copy link
Contributor

I don't use this extension, t it must be biting @maxious in production?

@nigelbabu
Copy link
Contributor

I just bit me in production. @maxious, I'm going to back out your pull request. I would highly prefer master actually work.

I'll move it to a branch called unstable and you can fix it in there. Does that sound okay?

@maxious
Copy link
Member

maxious commented Feb 16, 2015

Argh! Sorry guys! This is only the second time I've worked with threads in Python and it seemed to be working right. I can see in the debugger it's loading more and more threads every call :/

Anyway, I've moved the pool setup to the plugin and it only gets called once on CKAN startup.

I've got this in a branch but it can't merge to master because of the revert commit :/ https://github.com/datagovau/ckanext-googleanalytics/tree/api-analytics-event-tracking

@nigelbabu
Copy link
Contributor

@maxious I'll try to revert the revert and merge your branch in on an unstable branch and see how it goes. Don't worry about the pull request not working. I'll take care of it to make sure it all works.

@nigelbabu
Copy link
Contributor

I've setup a new pull request with @maxious fix. Please look at #13

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants