Nim is a statically typed compiled systems programming language. It combines successful concepts from mature languages like Python, Ada and Modula. Its design focuses on efficiency, expressiveness, and elegance (in that order of priority).
I'm creating relatively large web application in Nim.
I found a SIGSEGV: Illegal storage access. error happen after only raised Exception and catched safety.
I tried to create simple example but it seems only for relatively large program.
And it not happen when using Nim v2.0.0. Only in 2.0.2.
Run docker container. 8000 port on host need to be free.
cd realworld-basolato-htmx
git switch alloc-error
docker compose build
docker compose up -d
docker compose exec app bash
cd /root/project/src
choosenim 2.0.2
install dependency packages
nimble install -y -d
create .env file
copy .env.eample to .env
DB Connection section should be as bellow
DB_DATABASE="database" # sqlite file path or database name
DB_USER="user"
DB_PASSWORD="pass"
DB_HOST="postgres" # host ip address
DB_PORT=5432 # postgres default...5432, mysql default...3306
DB_MAX_CONNECTION=10 # should be smaller than (DB max connection / running num processes)
DB_TIMEOUT=30 # secounds
In the top of the screen, you can see error messages as expect
Click the left top icon to go top page, but it not moved. If you check the terminal, you can see the error message like this
My speculation
In the No.10, this error is raised src/app/models/aggregates/user/vo/password.nim as DomainError and catched in update proc insrc/app/http/controllers/htmx_setting_controller.nim
However, after catched error and responde safety, something memory management seems to be broken and Illegal storage access error happen in the next time access.
Nim Version
Nim Compiler Version 2.0.2 [Linux: amd64]
Compiled at 2023-12-15
Copyright (c) 2006-2023 by Andreas Rumpf
Description
I'm creating relatively large web application in Nim. I found a
SIGSEGV: Illegal storage access.
error happen after only raised Exception and catched safety. I tried to create simple example but it seems only for relatively large program. And it not happen when usingNim v2.0.0
. Only in2.0.2
.reproduction scenario
Clone application from github
Run docker container. 8000 port on host need to be free.
install dependency packages
create .env file copy
.env.eample
to.env
DB Connection section should be as bellowrun migration and seed for database
run application
access browser http://localhost:8000/
sign in http://localhost:8000/sign-in
access setting page http://localhost:8000/settings click
Update Settings
button without filing passwordIn the top of the screen, you can see error messages as expect
Click the left top icon to go top page, but it not moved. If you check the terminal, you can see the error message like this
My speculation
In the No.10, this error is raised
src/app/models/aggregates/user/vo/password.nim
asDomainError
and catched in update proc insrc/app/http/controllers/htmx_setting_controller.nim
However, after catched error and responde safety, something memory management seems to be broken and
Illegal storage access
error happen in the next time access.Nim Version
Nim Compiler Version 2.0.2 [Linux: amd64] Compiled at 2023-12-15 Copyright (c) 2006-2023 by Andreas Rumpf
git hash: c4c44d10df8a14204a75c34e499def200589cb7c
Current Output
No response
Expected Output
Possible Solution
No response
Additional Information
No response