You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Windows build number: 10.0.17134.285
Distro: Ubuntu 18.04.1 LTS
I want to use NGINX Unit but it fails with the following error:
{
"error": "Memory allocation failed."
}
Here's the content of /var/log/unit.log:
[info] 7148#7148 discovery started
[notice] 7148#7148 module: python 3.6.5 "/usr/lib/unit/modules/python3.6.unit.so"
[info] 7150#7150 controller started
[notice] 7146#7146 process 7148 exited with code 0
[info] 7151#7151 router started
[alert] 7150#7150 *3 memfd_create(/unit.7150.7fd46a63) failed (38: Function not implemented)
[alert] 7150#7150 *4 memfd_create(/unit.7150.aca6c7) failed (38: Function not implemented)
This happened when I tried to configure it using curl -X PUT -d @/path/to/configuration.json --unix-socket /run/control.unit.sock http://localhost/config/applications/app_name
Reacted by Antoine Latter, Idan Pazi, KSebion, Yang Yang and niu tech
Query for the devs: How "doable" is memfd_create() given the plumbing WSL has on hand? Normal "if it were easy it would exist" rules apply, natch. But I'm curious if it is in the realm of reasonably possible, or a bridge too far for the foreseeable future. Put another way, is lack thereof due mostly because it is fundamentally going to be hard (colloquially, "impossible") to map the behavior onto what you got, or because there is not a lot of demand (fairly demonstrably, given the large swaths of Linux-land that don't need it). I have some time-sink code that could use memfd, but upon thinking about it for a minute and hypothesizing on WSL internals I'm starting to wonder if this is a "straightforward to ask but hard to do" kind of thing.
We have thus far avoided implementing memory-backed files (memfd, tmpfs, et al.), instead relying on the system drive for temporary storage (aka really slow memory). We could do something similar here, in which case it would just be a little bit of infrastructure to handle the lifetimes of "anonymous" files. A better solution would require plumbing in some real tmpfs concepts, and that will be quite a bit more work, though I am not aware of any technical blockers.
Appreciate the reply Brian. My headspace when I wrote the query was in what you called "real tmpfs concepts" (which I know WSL doesn't have), but of course you can do anything memfd_create() can do with a real temp file (which is otherwise ignored) and a mmap(). Mild duh to self, thanks. Points to (rather obvious) approach for the time-sink code too. I just wasn't thinking about it straight, because my head was stuck in anonymous memory.
memfd_create()’s main benefit is to be able to place seals on the fd, so that other processes receiving this fd can know for sure it won’t e.g. shrink under their feet, this isn’t possible on Linux with other filesystems so far, including tmpfs.
Activity
therealkenc commentedon Sep 19, 2018
Ref #1209 for sport. I had forgotten it was left open as a landing zone for memfd and then closed it because the use case was satisfied.
therealkenc commentedon Oct 17, 2018
Query for the devs: How "doable" is
memfd_create()given the plumbing WSL has on hand? Normal "if it were easy it would exist" rules apply, natch. But I'm curious if it is in the realm of reasonably possible, or a bridge too far for the foreseeable future. Put another way, is lack thereof due mostly because it is fundamentally going to be hard (colloquially, "impossible") to map the behavior onto what you got, or because there is not a lot of demand (fairly demonstrably, given the large swaths of Linux-land that don't need it). I have some time-sink code that could use memfd, but upon thinking about it for a minute and hypothesizing on WSL internals I'm starting to wonder if this is a "straightforward to ask but hard to do" kind of thing.Brian-Perkins commentedon Oct 17, 2018
We have thus far avoided implementing memory-backed files (memfd, tmpfs, et al.), instead relying on the system drive for temporary storage (aka really slow memory). We could do something similar here, in which case it would just be a little bit of infrastructure to handle the lifetimes of "anonymous" files. A better solution would require plumbing in some real tmpfs concepts, and that will be quite a bit more work, though I am not aware of any technical blockers.
therealkenc commentedon Oct 17, 2018
Appreciate the reply Brian. My headspace when I wrote the query was in what you called "real tmpfs concepts" (which I know WSL doesn't have), but of course you can do anything
memfd_create()can do with a real temp file (which is otherwise ignored) and ammap(). Mild duh to self, thanks. Points to (rather obvious) approach for the time-sink code too. I just wasn't thinking about it straight, because my head was stuck in anonymous memory.incube8r commentedon May 29, 2019
Adding reference to NGINX Unit issue:
nginx/unit#256
linkmauve commentedon Oct 17, 2019
memfd_create()’s main benefit is to be able to place seals on the fd, so that other processes receiving this fd can know for sure it won’t e.g. shrink under their feet, this isn’t possible on Linux with other filesystems so far, including tmpfs.See the File Sealing section in the
fcntl(2)manpage: https://manpages.ubuntu.com/manpages/xenial/man2/fcntl.2.htmlyecril71pl commentedon Dec 2, 2019
Firefox crashes on openSUSE 15.1 (in
mozilla::layers::MemoryTextureHost::DeallocateSharedData).llvmpipe: Work around WSL 1 missing support for memfd_create()