Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
4 Risposte
4793 Visualizzazioni

Hi everyone, I'm trying to trigger a very simple web scraper from Odoo. Right now, all I am trying to do is to instantiate a webdriver.Chrome object inside one of my model's functions, that is triggered by a button on my form view.

I am able to run this code as a separate python script (simply doing python my_script.py) which proves that Selenium is correctly configured in my system. However, it seems like the Odoo server's threads have a problem running it:

selenium\.common\.exceptions\.WebDriverException:\ Message:\ Service\ /root/\.wdm/drivers/chromedriver/linux64/103.0.5060.53/chromedriver unexpectedly exited. Status code was: -5

I have spent several hours trying to understand what is going on, but to no avail. Things I've tried so far include using both Chrome, Chromium and Firefox; tried every single combination of Webdriver parameters (headless, etc.); trying giving full permissions on chromedriver, chrome and chromium executables (chmod 777); running odoo with and without sudo.

Unfortauntely nothing worked so far, so I started looking into Odoo's ThreadedServer code, so see if I found any reason why Selenium's subprocess.Popen calls wouldn't work, but unfortunately this is so beyond my knowledge that I don't even know what to Google!

Any insights would be greatly appreciated... thanks!

Avatar
Abbandona
Risposta migliore

The problem is related to limit_memory_hard. Increase it and it will work properly. I had the same issue. 

Avatar
Abbandona

I set it like limit_memory_hard=2684354560
but still the same

You need to increase it even more.

Oh yeah I agree, with
limit_memory_hard=99999999999
It works all okay, this was so strange, I wonder how you could find such resolution, thanks a lot

All thanks to your question! You inspired me the idea, and after a lot of test I was able to figure it out. Selenium is opening a browser, but Odoo limits the memory of the thread. It closes abruptly due to that limit. For that reason, it is necessary to increase it so much.

Risposta migliore

Hi, i try to apply the answer of Enric Tobella Alomar , but doesnt works for me, stay raising the error  "Status code was: -5". Im doing good?  

i go to the "odoo.conf" and add the next line:
limit_memory_hard=999999999999

its right like this?

Avatar
Abbandona
Risposta migliore

Please add the following line before creating the driver object.

https://github.com/Vauxoo/odoo-selenium/blob/main/src/odoo_selenium/selenium.py#L88

Avatar
Abbandona
Risposta migliore

I have the same error, I am working in Odoo 14 CE, Ubuntu 20, 8 GB Memory and 4 vCPUs, Any suggestions?

Avatar
Abbandona
Autore

I wasn't able to fix it, so what I did was I delegated the Selenium code to a small HTTP server running side on the same machine as my Odoo instance, and I just send requests from Odoo to the server.

Did you find any other solution? Also facing this issue

Hi Fred Nunes, How can I delegate the execution of selenium to a http server to send requests out of odoo? if you can share your solution it would be very helpful, thank you very much in advance

Hi Fred Nunes and Adnier Roselló.
Could you share your solution if you found it? Thank you.

Post correlati Risposte Visualizzazioni Attività
1
giu 25
1786
3
lug 25
3389
1
mag 25
1540
1
mag 25
1797
4
mag 25
2920