modularml / mojo

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

[BUG] Segmentation Fault #2147

Open TheAbhilash23 opened 7 months ago

TheAbhilash23 commented 7 months ago

Bug description

Code where this issue could be...

from lightbug_http.http import HTTPRequest, HTTPResponse, OK
from lightbug_http.service import HTTPService

@value
struct MyAppService(HTTPService):
    fn func(self, req: HTTPRequest) raises -> HTTPResponse:
        var body = req.body_raw
        var uri = req.uri()
        if uri.path() == "/":
            print("I'm on the index path!")
        print(req.host()) # This Line was added by me....... req.host() returns String type
        return OK(String("Hello, world").as_bytes(), "text/plain")

Command i ran

mojo lightbug.(fireemoji)

from

https://github.com/saviorand/lightbug_http

i got

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:
0.      Program arguments: mojo lightbug.\360\237\224\245
[2246846:2246847:20240402,190044.392765:ERROR directory_reader_posix.cc:42] opendir /home/abhilash/.modular/crashdb/attachments/d29d1020-e2ac-4ba6-98b1-002382ba6cfb: No such file or directory (2)
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0  mojo      0x00005e7555ed5e47
1  mojo      0x00005e7555ed3a1e
2  mojo      0x00005e7555ed651f
3  libc.so.6 0x000074d7a7fa3520
4  libc.so.6 0x000074d70402e2a1
Segmentation fault (core dumped)

Steps to reproduce

System information

- What OS did you do install Mojo on ?
Linux Ubuntu 22 LTS
- Provide version information for Mojo by pasting the output of `mojo -v`
mojo 24.1.1 (0ab415f7)
- Provide Modular CLI version by pasting the output of `modular -v`
modular 0.5.1 (1b608e3d)
JoeLoser commented 7 months ago

@jackos any interest in taking a look here if you have some cycles?

TheAbhilash23 commented 7 months ago

Steps to reproduce... Once you take a pull of repo

https://github.com/saviorand/lightbug_http

setup a route using the examples in the README file and start the server, once the server is running, try editing the route you defined.

This is now happening multiple times if i edit the file while the server (lightbug_http) is running