Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mlock return -1 #2

Open
skoppe opened this issue Aug 9, 2015 · 7 comments
Open

mlock return -1 #2

skoppe opened this issue Aug 9, 2015 · 7 comments

Comments

@skoppe
Copy link
Contributor

skoppe commented Aug 9, 2015

in securepool.d@224:
logError("Could not mlock " ~ to!string(pool_size) ~ " bytes");

mlock actually returns -1, which is weird since it is not a valid return value http://linux.die.net/man/2/mlock.

I'm running dmd v2.067 on ArchLinux in boot2docker on windows machine.

My app doesn't use the securepool so it will still compile and run.

@etcimon
Copy link
Owner

etcimon commented Aug 9, 2015

Can you get the errno for this?

import core.stdc.errno;
logError("Could not mlock " ~ to!string(pool_size) ~ " bytes: " ~ errno());

I forgot to log it. The -1 is return value for error, I get this often in the travis docker

@skoppe
Copy link
Contributor Author

skoppe commented Aug 9, 2015

12

think it is ENOMEM

Some of the specified address range does not correspond to mapped pages in the address space of the process.

@etcimon
Copy link
Owner

etcimon commented Aug 9, 2015

I think this might be a problem with ulimit -l setting, the memlock max. I should probably silence this error some way unless secure pool is being used. There's a great security advantage to using mlock'ed memory to avoid leaking crypto keys or passwords on the HDD through swapping/sleeping for example.

@skoppe
Copy link
Contributor Author

skoppe commented Aug 9, 2015 via email

@etcimon
Copy link
Owner

etcimon commented Feb 23, 2023

I explored this issue again and it seems like there's a big rabbit-hole of problems with locking memory in docker:
https://medium.com/@thejasongerard/resource-limits-mlock-and-containers-oh-my-cca1e5d1f259

I'm not sure how I could fix this in the library itself.

By the way, I've been working a lot with your spasm library, I setup memutils in it and removed the garbage collector in favor of memutils.scoped, made all the firefox bindings work through the generator with more syntax for the official webidl (the most common go through generic functions, the rest through VarArgs), added lodash lodash.d, a router and I'm working on integrating mir to have phobos-like capability and add mir.ion for serialization. The diet templates are cool but they depend on Fast and I need to switch out of it because it's GPL3

This is the last working commit: etcimon/libwasm@005df6b

The newer one will compile only once I'm done making everything from mir work with dub test (folders core/ algorithms/). My goal is to be able to develop UI tools directly in webassembly, such as grids, and replace React for building websites.

I changed the name because it would probably be hard for it to be merged anyways.

It compiles only with this version of LDC that adds support for new in betterC ctfe: https://github.com/etcimon/ldc

This is my test file: https://github.com/etcimon/libwasm/blob/master/examples/dom/source/app.d

@skoppe
Copy link
Contributor Author

skoppe commented Feb 24, 2023

I explored this issue again and it seems like there's a big rabbit-hole of problems with locking memory in docker: https://medium.com/@thejasongerard/resource-limits-mlock-and-containers-oh-my-cca1e5d1f259

I'm not sure how I could fix this in the library itself.

Yeah, no problem, I moved on in the 7 year since 😄

By the way, I've been working a lot with your spasm library, I setup memutils in it and removed the garbage collector in favor of memutils.scoped, made all the firefox bindings work through the generator with more syntax for the official webidl (the most common go through generic functions, the rest through VarArgs), added lodash lodash.d, a router and I'm working on integrating mir to have phobos-like capability and add mir.ion for serialization. The diet templates are cool but they depend on Fast and I need to switch out of it because it's GPL3

Awesome, that is good to hear. I have been meaning to get back to it, but work is in the way. I have some ideas on completing the druntime wasm port I started, supporting the GC etc., but it requires a lot of spelunking. Unsure when it is done. I hope to manage before dconf, but no guarantees.

This is the last working commit: etcimon/libwasm@005df6b

Cool. Will check it out when back from holiday.

I changed the name because it would probably be hard for it to be merged anyways.

No problem, the library is a bit dead, and while I have some fresh ideas, they will likely major rewrite.

@etcimon
Copy link
Owner

etcimon commented Feb 24, 2023

No problem, the library is a bit dead, and while I have some fresh ideas, they will likely major rewrite.

What I have been meaning to do, is use diet templates to have dynamically generated html, which is then merged (or not) recursively to populate the spasm structs or simply set the innerHTML. So basically it calls update on everything that changed through the HTML, and to accomodate missing fields the Node mixin would include a way to add attributes and properties that are used when applying changes to the DOM. That way, you can have a diet template that has a ton of slightly dynamic content elements without needing to build a ton of nodes for it.

The problem is that I'm waiting on a pull request in DMD. And then it has to merge into LDC.

dlang/dmd#14676

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants