google / google/or-tools

Ubuntu 22.04 Python 3.10 Memory Surge for Solver

Open
#3,857 3 comments 0 reactions 1 assignee Claimed by @Mizux View on GitHub
Feature Request Help Needed Lang: Python Solver: Routing
Dominant language
C++
Stars
14.1k
Forks
2.5k
Avg merge
8h 39m
Merged PRs (30d)
72

Description

Version: 9.6.2534
Language: Python

Solver - Routing Solver
OS - Ubuntu 22.04

Steps to reproduce the behavior:
```py
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**

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.