roadrunner-server / roadrunner-plugins

📦 Home for the roadrunner plugins
MIT License
25 stars 9 forks source link

[BUG] signal SIGSEGV: segmentation violation code=0x1 addr=0x38 pc=0xd7ca3d #143

Closed brzuchal closed 2 years ago

brzuchal commented 2 years ago

I tried running this:

/app # rr serve .rr.dev.yaml
{"level":"debug","ts":1638447404.4453213,"logger":"rpc","msg":"RPC plugin started","address":"tcp://127.0.0.1:6001","plugins":["informer","resetter","status"]}
[INFO] RoadRunner server started; version: 2.6.1, buildtime: 2021-12-02T09:27:17+0000
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x38 pc=0xd7ca3d]

goroutine 63 [running]:
github.com/spiral/roadrunner-plugins/v2/http.(*Plugin).workers(...)
        github.com/spiral/roadrunner-plugins/v2@v2.6.1/http/plugin.go:336
github.com/spiral/roadrunner-plugins/v2/http.(*Plugin).Workers(0xc000714160)
        github.com/spiral/roadrunner-plugins/v2@v2.6.1/http/plugin.go:320 +0xbd
github.com/spiral/roadrunner-plugins/v2/informer.(*Plugin).Workers(...)
        github.com/spiral/roadrunner-plugins/v2@v2.6.1/informer/plugin.go:33
github.com/spiral/roadrunner-plugins/v2/informer.(*rpc).Workers(0x2, {0xc00062bf80, 0x1}, 0xc000629e00)
        github.com/spiral/roadrunner-plugins/v2@v2.6.1/informer/rpc.go:31 +0x5e
reflect.Value.call({0xc0001e1500, 0xc00000f8e0, 0x13}, {0x1799a7e, 0x4}, {0xc0001f9ef8, 0x3, 0x3})
        reflect/value.go:543 +0x814
reflect.Value.Call({0xc0001e1500, 0xc00000f8e0, 0x10}, {0xc0000686f8, 0x3, 0x3})
        reflect/value.go:339 +0xc5
net/rpc.(*service).call(0xc000334d40, 0x0, 0x0, 0xc00062b3a0, 0xc0001db380, 0xc0000687d0, {0x1526d80, 0xc0000b1ae0, 0x19ed080}, {0x15d8ee0, ...}, ...)
        net/rpc/server.go:377 +0x239
created by net/rpc.(*Server).ServeCodec
        net/rpc/server.go:474 +0x405

My .rr.dev.yaml configuration is:

server:
    command: "php bin/console baldinof:roadrunner:worker"
    # If you are using symfony 5.3+ and the new Runtime component:
    # remove the previous `command` line above and uncomment the line below.
    # command: "php public/index.php"
    env:
        - APP_RUNTIME: Baldinof\RoadRunnerBundle\Runtime\Runtime
        - APP_DEBUG: 1
http:
    address: 0.0.0.0:3000
    uploads:
        forbid: [ ".php", ".exe", ".bat" ]
    headers:
        cors:
            allowed_origin: "*"
            allowed_headers: "*"
            allowed_methods: "GET,POST,PUT,DELETE"
            allow_credentials: false
            exposed_headers: "Cache-Control,Content-Type"
logs:
    mode: development
    channels:
        http:
            level: info
        server:
            level: info
            mode: raw
reload:
    enabled: true
    interval: 1s
    patterns: [".php", ".yaml"]
    services:
        http:
            dirs: ["."]
            recursive: true
status:
    address: localhost:3001
rpc:
    listen: tcp://127.0.0.1:6001

Please instruct how can I enrich with required details.

My installation details:

/app # php -v
PHP 8.1.0 (cli) (built: Nov 30 2021 07:15:23) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.0, Copyright (c) Zend Technologies
    with Zend OPcache v8.1.0, Copyright (c), by Zend Technologies
    with Xdebug v3.1.2, Copyright (c) 2002-2021, by Derick Rethans

Composer packages:

spiral/goridge           v3.1.1  High-performance PHP-to-Golang RPC bridge
spiral/roadrunner        v2.6.0  RoadRunner: High-performance PHP application server, load-balancer and process manager written in Golang
spiral/roadrunner-cli    v2.0.13 RoadRunner: Command Line Interface
spiral/roadrunner-http   v2.0.4  RoadRunner: HTTP and PSR-7 worker
spiral/roadrunner-worker v2.1.5  RoadRunner: PHP worker

RR version:

rr version 2.6.1 (build time: 2021-12-02T09:27:17+0000, go1.17.3)
rustatian commented 2 years ago

@brzuchal Hey, thanks for the report, I'll have a look ASAP.

brzuchal commented 2 years ago

Thanks, @rustatian I've enriched with some installation details.

rustatian commented 2 years ago

Could you please comment the status plugin?

brzuchal commented 2 years ago

@rustatian it helped me

rustatian commented 2 years ago

Ok, I'll have a look, looks like some plugin trying to get workers info when there are no workers yet in the pool. I'll release a bugfix soon.

rustatian commented 2 years ago

@brzuchal This issue occurred right after RR was started, correct?

rustatian commented 2 years ago

And the second question, with the status plugin, does this issue occur on every run or randomly?

brzuchal commented 2 years ago

Got another with the status disabled

app_1  | 2021-12-02T17:25:38.349Z       INFO    http            HTTP plugin got restart request. Restarting...
app_1  | panic: runtime error: invalid memory address or nil pointer dereference
app_1  | [signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0xd780e0]
app_1  | 
app_1  | goroutine 43 [running]:
app_1  | github.com/spiral/roadrunner-plugins/v2/http.(*Plugin).Reset(0xc0003081b0)
app_1  |        github.com/spiral/roadrunner-plugins/v2@v2.5.2/http/plugin.go:372 +0xc0
app_1  | github.com/spiral/roadrunner-plugins/v2/resetter.(*Plugin).Reset(0xc00037d630, {0xc00018b0f0, 0x4})
app_1  |        github.com/spiral/roadrunner-plugins/v2@v2.5.2/resetter/plugin.go:27 +0x142
app_1  | github.com/spiral/roadrunner-plugins/v2/reload.(*Plugin).Serve.func2()
app_1  |        github.com/spiral/roadrunner-plugins/v2@v2.5.2/reload/plugin.go:127 +0x2ee
app_1  | created by github.com/spiral/roadrunner-plugins/v2/reload.(*Plugin).Serve
app_1  |        github.com/spiral/roadrunner-plugins/v2@v2.5.2/reload/plugin.go:111 +0x27d
app_1 exited with code 2
rustatian commented 2 years ago

Yep, this is not related to the status this is a topological sort issue when the rpc plugin started before the informer plugin. I'll fix that, but I need more time to find a problem.

rustatian commented 2 years ago

@brzuchal Could you try the new version please: https://github.com/spiral/roadrunner-binary/releases/tag/v2.6.2?

brzuchal commented 2 years ago

@rustatian I can now confirm the new version works fine with the status configuration applied.