<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-signature">Hi Daniel,<br>
<br>
Many thanks for the reply again. An update: turns out when I
rebooted the machine to fix the issue with running osrm-datastore
across different users, I had forgotten that changes to
/etc/sysctl.conf are not persisted after rebooting, so all is
working fine now after adding the kernel.shmall and kernel.shmmax
properties again.<br>
<br>
Kind regards,<br>
Kieran Caplice<br>
<br>
</div>
<div class="moz-cite-prefix">On 29/01/18 18:07, Daniel Patterson
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CANvddS+7Yzf_ahHOb41Oz-cqFgtMEB4ktn8qVufguq6ubHurFA@mail.gmail.com">
<div dir="ltr">Hi Kieran,
<div><br>
</div>
<div> The problem is definitely occurring when trying to
allocate the shared memory block. This line from your strace
output shows the error happening:</div>
<div><br>
</div>
<div><span style="font-size:12.8px">shmget(0x10001b9,
96772768369, IPC_CREAT|0644) = -1 EINVAL (Invalid argument)</span><br>
</div>
<div><span style="font-size:12.8px"><br>
</span></div>
<div><span style="font-size:12.8px"> I suspect the "code 21
(EISDIR)" message we're printing out here is wrong or
misleading, maybe.</span></div>
<div><span style="font-size:12.8px"><br>
</span></div>
<div><span style="font-size:12.8px"> Can you try playing with
the constants in this test program?</span></div>
<div><span style="font-size:12.8px"><br>
</span></div>
<div><span style="font-size:12.8px"><br>
</span></div>
<div><span style="font-size:12.8px">-----------BEGIN
test.c-----------------------</span></div>
<div>
<div><span style="font-size:12.8px">#include <sys/shm.h></span></div>
<div><span style="font-size:12.8px">#include <stdio.h></span></div>
<div><span style="font-size:12.8px">#include <errno.h></span></div>
<div><span style="font-size:12.8px">#include <string.h></span></div>
<div><span style="font-size:12.8px">#include <sys/ipc.h></span></div>
<div><span style="font-size:12.8px"><br>
</span></div>
<div><span style="font-size:12.8px">//#define MEMORY_SIZE
96772768369</span></div>
<div><span style="font-size:12.8px">#define MEMORY_SIZE
1024*1024</span></div>
<div><span style="font-size:12.8px">#define KEY_PATH
"/tmp/osrm.lock"</span></div>
<div><span style="font-size:12.8px"><br>
</span></div>
<div><span style="font-size:12.8px">int main(void) {</span></div>
<div><span style="font-size:12.8px"><br>
</span></div>
<div><span style="font-size:12.8px"> key_t tok =
ftok(KEY_PATH, 0);</span></div>
<div><span style="font-size:12.8px"><br>
</span></div>
<div><span style="font-size:12.8px"> // Original that was
being called</span></div>
<div><span style="font-size:12.8px"> //int result =
shmget(0x10001b9, 96772768369, IPC_CREAT|0644);</span></div>
<div><span style="font-size:12.8px"><br>
</span></div>
<div><span style="font-size:12.8px"> int result = shmget(tok,
MEMORY_SIZE, IPC_CREAT|0644);</span></div>
<div><span style="font-size:12.8px"><br>
</span></div>
<div><span style="font-size:12.8px"> if (result == -1) {</span></div>
<div><span style="font-size:12.8px"> printf("shmget
returned -1: errno is %d: %s\n", errno, strerror(errno));</span></div>
<div><span style="font-size:12.8px"> } else {</span></div>
<div><span style="font-size:12.8px"> printf("shmget worked
- cleaning up\n");</span></div>
<div><span style="font-size:12.8px"> shmctl(result,
IPC_RMID, NULL);</span></div>
<div><span style="font-size:12.8px"> }</span></div>
<div><span style="font-size:12.8px"><br>
</span></div>
<div><span style="font-size:12.8px">}</span></div>
</div>
<div><span style="font-size:12.8px">--------------END
test.c-----------------------------</span></div>
<div><span style="font-size:12.8px"><br>
</span></div>
<div><span style="font-size:12.8px"> Try different values of
"MEMORY_SIZE", and also try uncommenting the original shmget
line that I've included, see if that works standalone, and
see what messages you get.</span></div>
<div><span style="font-size:12.8px"><br>
</span></div>
<div><span style="font-size:12.8px"> Compiling the test program
should be a simple "gcc test.c"</span></div>
<div><span style="font-size:12.8px"><br>
</span></div>
<div><span style="font-size:12.8px">daniel</span></div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Mon, Jan 29, 2018 at 1:48 AM, Kieran
Caplice <span dir="ltr"><<a
href="mailto:kieran.caplice@temetra.com" target="_blank"
moz-do-not-send="true">kieran.caplice@temetra.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">Hi
Julien/Daniel,<br>
<br>
Thanks for the replies. I had read that github issue prior
to emailing the list, and it did solve the initial error I
was having, which was due to running osrm-datastore as root
and later as user "osrm". Rebooting the machine solved this
as it did for you, Julien. But after that I'm faced with
this issue.<br>
<br>
@Daniel: /tmp contains the two files:<br>
-rw-rw-r-- 1 osrm osrm 0 Jan 26 16:34
osrm-datastore.lock<br>
-rw-rw-r-- 1 osrm osrm 0 Jan 26 16:34 osrm.lock<br>
<br>
Output of the strace:<br>
<br>
root@htzh /opt/osrm # su - osrm -c "strace osrm-datastore
/opt/osrm/data/planet-latest/p<wbr>lanet-latest.osrm"<br>
...<br>
open("/opt/osrm/data/planet-la<wbr>test/planet-latest.osrm.tld",
O_RDONLY) = 5<br>
read(5, "OSRN\5\17\0M\25\17\0\0\0\0\0\<wbr>0\1\0\3\0\1\1\3\0\1\0\v\0\1\1\<wbr>v\0"...,
8191) = 8191<br>
close(5) <wbr> = 0<br>
stat("/opt/osrm/data/planet-la<wbr>test/planet-latest.osrm.partit<wbr>ion",
0x7ffcde3c8d20) = -1 ENOENT (No such file or directory)<br>
stat("/opt/osrm/data/planet-la<wbr>test/planet-latest.osrm.cells"<wbr>,
0x7ffcde3c8d20) = -1 ENOENT (No such file or directory)<br>
stat("/opt/osrm/data/planet-la<wbr>test/planet-latest.osrm.cell_<wbr>metrics",
0x7ffcde3c8d20) = -1 ENOENT (No such file or directory)<br>
stat("/opt/osrm/data/planet-la<wbr>test/planet-latest.osrm.mldgr"<wbr>,
0x7ffcde3c8d20) = -1 ENOENT (No such file or directory)<br>
ioctl(1, TCGETS, {B38400 opost isig icanon echo ...}) = 0<br>
ioctl(1, TCGETS, {B38400 opost isig icanon echo ...}) = 0<br>
write(1, "[info] Allocating shared memory "..., 57[info]
Allocating shared memory of 96772768369 bytes<br>
) = 57<br>
stat("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096,
...}) = 0<br>
stat("/tmp/osrm.lock", {st_mode=S_IFREG|0664, st_size=0,
...}) = 0<br>
stat("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096,
...}) = 0<br>
stat("/tmp/osrm.lock", {st_mode=S_IFREG|0664, st_size=0,
...}) = 0<br>
shmget(0x10001b9, 96772768369, IPC_CREAT|0644) = -1 EINVAL
(Invalid argument)<br>
ioctl(1, TCGETS, {B38400 opost isig icanon echo ...}) = 0<br>
ioctl(1, TCGETS, {B38400 opost isig icanon echo ...}) = 0<br>
write(2, "\33[31m[error] Error while attempt"..., 88[error]
Error while attempting to allocate shared memory: Invalid
argument, code 21) = 88<br>
write(2, "\33[0m", 4) = 4<br>
write(2, "\n", 1<br>
) = 1<br>
write(2, "terminate called after throwing "..., 48terminate
called after throwing an instance of ') = 48<br>
...<br>
<br>
Can you provide any further insight into what the problem
might be?<br>
<br>
By the way, we're using the latest release version (v5.15.0)
built from source on 16.04.<br>
<br>
Kind regards,<br>
Kieran Caplice
<div class="HOEnZb">
<div class="h5"><br>
<br>
On 26/01/18 17:48, Julien Coupey wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex"> Hi,<br>
<br>
Not sure if you're hitting the same problem here, but
I recall a related discussion happening a while back
at:<br>
<br>
<a
href="https://github.com/Project-OSRM/osrm-backend/issues/1724"
rel="noreferrer" target="_blank"
moz-do-not-send="true">https://github.com/Project-OSR<wbr>M/osrm-backend/issues/1724</a><br>
<br>
At least it provides a few hints on permissions and
shared memory.<br>
<br>
Julien<br>
<br>
Le 26/01/2018 à 18:31, Daniel Patterson a écrit :<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
Kieran,<br>
<br>
Hmm, we could probably improve the error handling
here and make the message a bit more useful.<br>
<br>
The problem is probably one of:<br>
<br>
1) Permission problems accessing /tmp/osrm.lock<br>
2) Permission problems creating shared memory<br>
<br>
Code 21 is:<br>
<br>
$ errno 21<br>
EISDIR 21 Is a directory<br>
<br>
So I'd suspect some bad filesystem permissions
somewhere. You can try running the `osrm-datastore`
command under `strace` and see if you can spot the
syscal that's failing with - that might give a hint
as to what's going wrong.<br>
<br>
daniel<br>
<br>
On Fri, Jan 26, 2018 at 8:57 AM, Kieran Caplice <<a
href="mailto:kieran.caplice@temetra.com"
target="_blank" moz-do-not-send="true">kieran.caplice@temetra.com</a>
<mailto:<a
href="mailto:kieran.caplice@temetra.com"
target="_blank" moz-do-not-send="true">kieran.caplice@temetra<wbr>.com</a>>>
wrote:<br>
<br>
Hello,<br>
<br>
I'm wondering if anyone can help out with this
error I'm getting<br>
when running osrm-datastore under a non-root
user:<br>
<br>
root@htzh /opt/osrm # su - osrm -c
"osrm-datastore<br>
/opt/osrm/data/planet-latest/p<wbr>lanet-latest.osrm"<br>
[info] Loading data into REGION_1<br>
[info] load names from:<br>
"/opt/osrm/data/planet-latest/<wbr>planet-latest.osrm.names"<br>
[info] Allocating shared memory of 96772768369
bytes<br>
[error] Error while attempting to allocate
shared memory: Invalid<br>
argument, code 21<br>
terminate called after throwing an instance of
'osrm::util::exception'<br>
what(): Invalid
argumentinclude/storage/shared<wbr>_memory.hpp:308<br>
root@htzh /opt/osrm # su - osrm -c "ulimit -a |
grep max"<br>
max locked memory (kbytes, -l)
128849018880<br>
max memory size (kbytes, -m) unlimited<br>
max user processes (-u) 1031189<br>
<br>
Available shared memory for the user has been
increased in<br>
/etc/security/limits.conf as per the wiki page,
as shown above.<br>
<br>
The server has 256GB of RAM, with at least 200GB
available most of<br>
the time. I successfully ran osrm-datastore and
osrm-routed as the<br>
root user earlier, but we would ideally run it
under a separate user.<br>
<br>
Thanks in advance.<br>
<br>
Kind regards,<br>
Kieran Caplice<br>
<br>
<br>
______________________________<wbr>_________________<br>
OSRM-talk mailing list<br>
<a href="mailto:OSRM-talk@openstreetmap.org"
target="_blank" moz-do-not-send="true">OSRM-talk@openstreetmap.org</a>
<mailto:<a
href="mailto:OSRM-talk@openstreetmap.org"
target="_blank" moz-do-not-send="true">OSRM-talk@openstreetma<wbr>p.org</a>><br>
<a
href="https://lists.openstreetmap.org/listinfo/osrm-talk"
rel="noreferrer" target="_blank"
moz-do-not-send="true">https://lists.openstreetmap.or<wbr>g/listinfo/osrm-talk</a><br>
<<a
href="https://lists.openstreetmap.org/listinfo/osrm-talk"
rel="noreferrer" target="_blank"
moz-do-not-send="true">https://lists.openstreetmap.o<wbr>rg/listinfo/osrm-talk</a>><br>
<br>
<br>
<br>
<br>
______________________________<wbr>_________________<br>
OSRM-talk mailing list<br>
<a href="mailto:OSRM-talk@openstreetmap.org"
target="_blank" moz-do-not-send="true">OSRM-talk@openstreetmap.org</a><br>
<a
href="https://lists.openstreetmap.org/listinfo/osrm-talk"
rel="noreferrer" target="_blank"
moz-do-not-send="true">https://lists.openstreetmap.or<wbr>g/listinfo/osrm-talk</a><br>
<br>
</blockquote>
<br>
______________________________<wbr>_________________<br>
OSRM-talk mailing list<br>
<a href="mailto:OSRM-talk@openstreetmap.org"
target="_blank" moz-do-not-send="true">OSRM-talk@openstreetmap.org</a><br>
<a
href="https://lists.openstreetmap.org/listinfo/osrm-talk"
rel="noreferrer" target="_blank"
moz-do-not-send="true">https://lists.openstreetmap.or<wbr>g/listinfo/osrm-talk</a><br>
</blockquote>
<br>
<br>
______________________________<wbr>_________________<br>
OSRM-talk mailing list<br>
<a href="mailto:OSRM-talk@openstreetmap.org"
target="_blank" moz-do-not-send="true">OSRM-talk@openstreetmap.org</a><br>
<a
href="https://lists.openstreetmap.org/listinfo/osrm-talk"
rel="noreferrer" target="_blank"
moz-do-not-send="true">https://lists.openstreetmap.or<wbr>g/listinfo/osrm-talk</a><br>
</div>
</div>
</blockquote>
</div>
<br>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
OSRM-talk mailing list
<a class="moz-txt-link-abbreviated" href="mailto:OSRM-talk@openstreetmap.org">OSRM-talk@openstreetmap.org</a>
<a class="moz-txt-link-freetext" href="https://lists.openstreetmap.org/listinfo/osrm-talk">https://lists.openstreetmap.org/listinfo/osrm-talk</a>
</pre>
</blockquote>
<br>
</body>
</html>