modularml / mojo

The Mojo Programming Language
https://docs.modular.com/mojo/manual/
Other
23.27k stars 2.59k forks source link

[BUG] Debian 12 - Memory Protection Violation when using value from list #3205

Closed Karolcha100 closed 1 month ago

Karolcha100 commented 4 months ago

Bug description

When program is started, its breaks in v2_BACKEND.mojo in somewhere in line 392. As far as i understand, i think that it is due to something wrong with "possible_connections" list, in 'calculate_random_connections_create' method, in 'Graph' structure.

I tried to copy that list, and do other stuff, but program always breaks when im trying to get elements from that list (note that, it is breaking after second use). When i ran program with random.seed(time.now()), the breaking point was also diffrent, but always connected to that list.

Here is an output when i run the main.mojo

Round: 1 Akts: 2 Conects: 1 Mean energy: 52.0 Time: 0.0 Round: 2 Akts: 4 Conects: 3 Mean energy: 48.022743225097656 Time: 0.0 y= 2 x= 3 w= 3 Please submit a bug report to https://github.com/modularml/mojo/issues and include the crash backtrace along with all > the relevant source codes. Stack dump:

  1. Program arguments: mojo main.mojo

    0 0x0000555fee12e438 (/home/karol/.modular/pkg/packages.modular.com_mojo/bin/mojo+0x12a1438)

    1 0x0000555fee12c25e (/home/karol/.modular/pkg/packages.modular.com_mojo/bin/mojo+0x129f25e)

    2 0x0000555fee12eacd (/home/karol/.modular/pkg/packages.modular.com_mojo/bin/mojo+0x12a1acd)

    3 0x00007f355a85b050 (/lib/x86_64-linux-gnu/libc.so.6+0x3c050)

    4 0x0000555fef8cc54c (/home/karol/.modular/pkg/packages.modular.com_mojo/bin/mojo+0x2a3f54c)

    5 0x0000555fef8dc27a (/home/karol/.modular/pkg/packages.modular.com_mojo/bin/mojo+0x2a4f27a)

    6 0x0000555fef8dc45e (/home/karol/.modular/pkg/packages.modular.com_mojo/bin/mojo+0x2a4f45e)

    7 0x0000555fef8db4da (/home/karol/.modular/pkg/packages.modular.com_mojo/bin/mojo+0x2a4e4da)

    8 0x0000555fef8db2d1 (/home/karol/.modular/pkg/packages.modular.com_mojo/bin/mojo+0x2a4e2d1)

    9 0x0000555ff0518d0e (/home/karol/.modular/pkg/packages.modular.com_mojo/bin/mojo+0x368bd0e)

    10 0x00007f354b63cf28 KGEN_CompilerRT_AlignedFree (/home/karol/.modular/pkg/packages.modular.com_mojo/lib/libKGENCompilerRTShared.so.19.0git+0x3cf28)

    11 0x00007f35040177e4

    mojo crashed! Please file a bug report. Naruszenie ochrony pamięci

where "Naruszenie ochrony pamięci" means "Memory protection violation".

below i attached .txt versions of main.mojo and v2_BACKEND.mojo. main.txt v2_BACKEND.txt

Steps to reproduce

Run main.mojo which imports Graph Struct from v2_BACKEND.mojo It will write some variable values and you will get error.

As i said, in my opinion it is mostly about 'possible_connections' list in 'calculate_random_connections_create' method.

System information

- What OS did you do install Mojo on ? - Debian 12 Bookworm
- Provide version information for Mojo by pasting the output of `mojo -v` - mojo 24.4.0 (2cb57382)
- Provide Modular CLI version by pasting the output of `modular -v` - modular 0.8.0 (39a426b5)
ematejska commented 4 months ago

Thanks for filing. Would you be able to provide a reduced testcase to help narrow this down?

JoeLoser commented 1 month ago

Closing the issue due to inactivity. Please re-open with source code for the repro.