urbit / vere

An implementation of the Urbit runtime
MIT License
59 stars 39 forks source link

~mopfel-winrux running into a memory issue #624

Open mopfel-winrux opened 7 months ago

mopfel-winrux commented 7 months ago

~mopfel-winrux has been running into a loom: fault mprotect error. I fixed this a couple of days ago with a |pack but it keep occurring. I'm copying a folder of my pier I can make available. My dojo output is below:

clay: read-at-tako fail [desk=%groups care=%c case=[%da p=~2024.3.19..19.25.31..20e0] path=/json/ui-vita]
[%no-cast-from %json %ui-vita]
[%error-building-cast %json %ui-vita]
[%error-building-tube %json %ui-vita]
%contacts: on-poke with mark %contact-action-0
eyre: missing subscription in unsubscribe 1710874934-fad5d8 55
loom: fault mprotect (197681): Out of memory
Assertion '0' failed in pkg/noun/manage.c:1810

bail: oops
home: bailing out
ames: packet dropped (272000 total)
pier: EOF
pier: work exit: status 0, signal 6
joemfb commented 7 months ago

That's mprotect() returning ENOMEM, which almost certainly means that we were trying to exceed the kernels max number of virtual-memory mappings (vm.max_map_count). mprotect() can increase the number of mappings by splitting ranges, for example: a single mapping of 3 read-only pages becomes 3 mappings if the middle page is changed to read/write.

The linux default per-process max is 65530, which is quite low. You can temporarily change the max with sysctl –w vm.max_map_count=..., or permanently change it by editing /etc/sysctl.conf.

Some more details and context: