django / asgi_ipc

IPC-based ASGI channel layer
BSD 3-Clause "New" or "Revised" License
37 stars 13 forks source link

shared memory segment and semaphore names suffixes are too large for OS X #4

Closed stratoukos closed 8 years ago

stratoukos commented 8 years ago

Asgi_ipc uses "/%s-channel-dict" for the shared memory segment name and "/%s-channel-dict-semaphore" (where %s is the configured prefix).

Mac OS X's IPC name sizes cannot be more than 30 bytes (source, second list item). This means that the maximum usable prefix on OS X is 6 characters, which is pretty small.

One solution would be to change the suffixes to something smaller (like "-chan" and "-chan-sem"). I can provide a PR if this solution is ok.

Thanks.

andrewgodwin commented 8 years ago

Yes, that fix sounds good to me, and we should stick a nice validation check on the name length too.

stratoukos commented 8 years ago

I'm not sure how would we validate that, since every system has different max sizes. After a bit of testing I got these max values:

We could maintain a list of hardcoded values, but this sounds like a bad idea.

Posix-ipc already raises ValueError: The name is too long for these cases, so the error is not that bad.

andrewgodwin commented 8 years ago

Ah, if the error is that clear then I think it's fine.