Closed garlic0x1 closed 12 months ago
A feedback on the issue can be informative to us all, even if not Mito-related ;) Was it an issue of building a binary with top-level DB functions?
A feedback on the issue can be informative to us all, even if not Mito-related ;) Was it an issue of building a binary with top-level DB functions?
Yeah after further testing I realized that that I was having the same issue with postmodern and raw SQL drivers when building a binary, still have not solved the problem, happens on SBCL (multiple versions tested) and Clozure
Problem solved thanks to Shinmera on #commonlisp:
<Shinmera> I'm not even gonna look at the code because I already know the issue: you cannot create variables or anything in foreign memory and expect them to stay sane after dumping an executable
<Shinmera> you have to create your database connection or whatever it is in the function that's run when the executable starts
<Shinmera> so (defvar ... (something-that-calls-cffi)) will never work
Mito seems to be causing a memory corruption problem when I package the application as a binary executable. Everything works fine in an interactive setting and I only see this when running the binary SBCL makes.
I have tried both (asdf:make) and (sb-ext:save-lisp-and-die) to make binaries, but I get the same issue with both.
I have also tried using both sqlite3 and postgres drivers, both have the same error.
Here is a POC of the issue and more details: https://github.com/garlic0x1/mito-error-poc