Contributors mailing list archives

Browse archives


Warning: Using "numpy" library you will have weird errors in production even if you are not using it

Vauxoo, Moisés López Calderón
- 30/10/2020 18:34:45
Hello OCA Contributors,

numpy is a powerful math library
But there are weird issues that could be a nightmare in production to found them.

Imagine that you start your odoo-bin and during starting you just see the following message:

    2020-10-29 15:13:15,053 194 INFO openerp_test odoo.modules.loading: updating modules list
    Segmentation fault (core dumped)

You can run gdb to find more details but it shows:

    [New Thread 0x7fb752885700 (LWP 1630)]
    Program received signal SIGSEGV, Segmentation fault.
    [Switching to Thread 0x7fb752885700 (LWP 1630)]
    0x0000000000000000 in ?? ()

Really, WT* is that?
Where is the issue man?

After 3 days of my weekend without sleep and running line by line I found that the impostor was: numpy

I just uninstalled and now all is working well.

The weird part is that this is a corner case issue and it is not reproduced easily.
Virtualization environment with a particular kind of processor.
In our case it was reproduced only and only in production environment (no staging ones)

Another issue was that all processors were used 100%
We just uninstalled numpy and now all is working well.

The issue is only using this line: "import numpy"
Even if you are not using that odoo module it line is executed and all your environment will be broken.

More info about the issues:
 - Vx/MQT#315 (Big debug history)
 - numpy#17674 (more recent)
 - numpy#13059 (guilty I didn't sleep for 3 days)

The following libraries are using numpy as dependency:
 - pandas
 - bokeh
 - altair
 - websocket

So the following OCA projects depends of numpy:
 - OCA/web

In fact, numpy is deprecating financial operations, we can use the following library:

IMHO we should add to "numpy" in the blacklist of libraries in the OCA
And look for other alternatives.
For pandas, I know it could increase the performance to process too much records
but in Odoo we have PostgreSQL and maybe we could find similar results.

Maybe a pipeline warning for our CI could be helpful if this library is installed.

What do you think?

Moisés López Calderón
Mobile: (+52) 477-752-22-30
Twitter: @moylop260
hangout: - Odoo Gold Partner
Twitter: @vauxoo