google / or-tools

Google's Operations Research tools:
https://developers.google.com/optimization/
Apache License 2.0
11.11k stars 2.11k forks source link

Ubuntu 22.04 Python 3.10 Memory Surge for Solver #3857

Open poirot-19 opened 1 year ago

poirot-19 commented 1 year ago

Version: 9.6.2534 Language: Python

Solver - Routing Solver OS - Ubuntu 22.04

Steps to reproduce the behavior:

def solve(self):
        search_parameters = pywrapcp.DefaultRoutingSearchParameters()
        search_parameters.time_limit.seconds = {
                                                                                     "max": 120,
                                                                                      "min": 5,
                                                                                      "ratio": 1
                                                                                        }
        search_parameters.first_solution_strategy = 'AUTOMATIC'
        if self.routing_options['local_search_metaheuristic']:
            search_parameters.local_search_metaheuristic = 'GUIDED_LOCAL_SEARCH`
        search_parameters.log_search = true
        search_parameters.use_cp_sat = false
        return self.get_solution(self.routing_model.SolveWithParameters(search_parameters))

Before this I have created the Routing Model object What did you expect to see Routes getting created

What did you see instead? Huge memory surge from 120 MB -> 1.6 GB and continuously increasing leading to restart of Docker container.

I am running the same code on Ubuntu 20.04 with Python 3.8, its working perfectly fine Another observation is that if I add @profile (memory_profiler) decorator to Solve function then it works fine.

Error Message below

WARNING: All log messages before absl::InitializeLog() is called are written to STDERR

I0000 00:00:1689454096.761452      15 routing.cc:3379] All Unperformed Solution (5980000000, time = 70 ms, memory used = 353.11 MB)

I0000 00:00:1689454096.762653      15 search.cc:265] Start search (memory used = 353.11 MB)

I0000 00:00:1689454096.774135      15 search.cc:265] Root node processed (time = 11 ms, constraints = 6279, memory used = 353.15 MB)

[2023-07-15 20:48:34,789: ERROR/MainProcess] Process 'ForkPoolWorker-1' pid:15 exited with 'signal 9 (SIGKILL)'

[2023-07-15 20:48:34] [ERROR] [f:request.py] [l:544] [n:celery.worker.request] Task handler raised error: WorkerLostError('Worker exited prematurely: signal 9 (SIGKILL).')

Traceback (most recent call last):

  File "/usr/local/lib/python3.10/dist-packages/billiard/pool.py", line 1265, in mark_as_worker_lost

    raise WorkerLostError(

billiard.exceptions.WorkerLostError: Worker exited prematurely: signal 9 (SIGKILL).

Make sure you include information that can help us debug (full error message, model Proto). Anything else we should know about your project / environment Its solving the VRP problem with around 400 tasks.

If you need exact steps to reproduce, please let me know, i will try to add more details

lperron commented 1 year ago

Not sure it has anything to do with the routing library. Seems like a gc/memory allocation problem in the docker library.

poirot-19 commented 1 year ago

@lperron same thing is happening when running on GCP Ubuntu VM 22.04 and Python 3.10. When the same application code runs on Ubuntu 20.04 and Python 3.8, it works perfectly fine. Do you think Solver has some issues on Ubuntu 22.04

lperron commented 1 year ago

No. This is the same code.

Le sam. 15 juil. 2023, 23:55, abhinav-94 @.***> a écrit :

@lperron https://github.com/lperron same thing is happening when running on GCP Ubuntu VM 22.04 and Python 3.10. When the same application code runs on Ubuntu 20.04 and Python 3.8, it works perfectly fine. Do you think Solver has some issues on Ubuntu 22.04

— Reply to this email directly, view it on GitHub https://github.com/google/or-tools/issues/3857#issuecomment-1636999215, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACUPL3MKK5L4Z4U6PFXXLCLXQOF5FANCNFSM6AAAAAA2LQDDYE . You are receiving this because you were mentioned.Message ID: @.***>