django - Numpy Runtime Warning causing Apache Workers to freeze in "Sending Reply" state -


recently, tracking down elusive bug in code. came down numpy code computes mean of part of array.

np.array(x[x == i]).mean(0) 

of course, if there no elements in x value of i previous code equivalent calculating mean of empty array.

np.array([]).mean(0) 

this results in value nan. on architectures, results in warning.

runtimewarning: invalid value encountered in double_scalars

we fixed code , works great now, there part of story bit more troubling.

the way bug manifest caused apache processes seize every worker stuck in "sending reply" state. workers caught in "sending reply" not actual worker caused problem, followed after it. no python exceptions raised, memory usage fine, , cpu barely being used. crippled apache until become unresponsive.

enter image description here

we use apache, django, mod_wsgi, , numpy among other things.

any ideas on why numpy code caused apache seize up? take action prevent in future.

see:

from memory numpy affected variant of issue. ensure force wsgi application run in main interpreter context.


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -