swh-graph: loading maps fail when available memory is too low: Cannot allocate memory
As per title, this happens on granet when doing systemctl status swhgraphdev.service
(after having successfully started swhgraphshm
) here's a log:
lug 15 15:12:12 granet systemd[1]: Started swh graph.
lug 15 15:12:12 granet swh[1535223]: INFO:root:using swh-graph JAR: /opt/swhgraph_venv/share/swh-graph/swh-graph-0.2.7.jar
lug 15 15:12:13 granet swh[1535234]: Loading graph /dev/shm/swh-graph/default/graph ...
lug 15 15:14:47 granet swh[1535234]: Graph loaded.
lug 15 15:14:47 granet swh[1535223]: Traceback (most recent call last):
lug 15 15:14:47 granet swh[1535223]: File "/opt/swhgraph_venv/bin/swh", line 10, in <module>
lug 15 15:14:47 granet swh[1535223]: sys.exit(main())
lug 15 15:14:47 granet swh[1535223]: File "/opt/swhgraph_venv/lib/python3.7/site-packages/swh/core/cli/__init__.py", line 97, in main
lug 15 15:14:47 granet swh[1535223]: return swh(auto_envvar_prefix='SWH')
lug 15 15:14:47 granet swh[1535223]: File "/opt/swhgraph_venv/lib/python3.7/site-packages/click/core.py", line 764, in __call__
lug 15 15:14:47 granet swh[1535223]: return self.main(*args, **kwargs)
lug 15 15:14:47 granet swh[1535223]: File "/opt/swhgraph_venv/lib/python3.7/site-packages/click/core.py", line 717, in main
lug 15 15:14:47 granet swh[1535223]: rv = self.invoke(ctx)
lug 15 15:14:47 granet swh[1535223]: File "/opt/swhgraph_venv/lib/python3.7/site-packages/click/core.py", line 1137, in invoke
lug 15 15:14:47 granet swh[1535223]: return _process_result(sub_ctx.command.invoke(sub_ctx))
lug 15 15:14:47 granet swh[1535223]: File "/opt/swhgraph_venv/lib/python3.7/site-packages/click/core.py", line 1137, in invoke
lug 15 15:14:47 granet swh[1535223]: return _process_result(sub_ctx.command.invoke(sub_ctx))
lug 15 15:14:47 granet swh[1535223]: File "/opt/swhgraph_venv/lib/python3.7/site-packages/click/core.py", line 956, in invoke
lug 15 15:14:47 granet swh[1535223]: return ctx.invoke(self.callback, **ctx.params)
lug 15 15:14:47 granet swh[1535223]: File "/opt/swhgraph_venv/lib/python3.7/site-packages/click/core.py", line 555, in invoke
lug 15 15:14:47 granet swh[1535223]: return callback(*args, **kwargs)
lug 15 15:14:47 granet swh[1535223]: File "/opt/swhgraph_venv/lib/python3.7/site-packages/click/decorators.py", line 17, in new_func
lug 15 15:14:47 granet swh[1535223]: return f(get_current_context(), *args, **kwargs)
lug 15 15:14:47 granet swh[1535223]: File "/opt/swhgraph_venv/lib/python3.7/site-packages/swh/graph/cli.py", line 284, in serve
lug 15 15:14:47 granet swh[1535223]: with backend:
lug 15 15:14:47 granet swh[1535223]: File "/opt/swhgraph_venv/lib/python3.7/site-packages/swh/graph/backend.py", line 57, in __enter__
lug 15 15:14:47 granet swh[1535223]: self.pid2node = PidToNodeMap(self.graph_path + "." + PID2NODE_EXT)
lug 15 15:14:47 granet swh[1535223]: File "/opt/swhgraph_venv/lib/python3.7/site-packages/swh/graph/pid.py", line 192, in __init__
lug 15 15:14:47 granet swh[1535223]: super().__init__(self.RECORD_SIZE, fname, mode=mode, length=length)
lug 15 15:14:47 granet swh[1535223]: File "/opt/swhgraph_venv/lib/python3.7/site-packages/swh/graph/pid.py", line 129, in __init__
lug 15 15:14:47 granet swh[1535223]: self.fd, self.size, flags=MAP_SHARED if writable_map else MAP_PRIVATE
lug 15 15:14:47 granet swh[1535223]: OSError: [Errno 12] Cannot allocate memory
lug 15 15:14:47 granet systemd[1]: swhgraphdev.service: Main process exited, code=exited, status=1/FAILURE
I think it's related to the shm trick.
This is stopping starting the graph service on the newly exported graph.
Migrated from T2492 (view on Phabricator)