waku-org / nwaku

Waku node and protocol.
Other
184 stars 47 forks source link

bug: strange errors when light pushing messages with payload >= 300 kb #2565

Closed fbarbu15 closed 2 weeks ago

fbarbu15 commented 2 months ago

Problem

When the payload is >= 300 kb the light push fails with some strange messages

  1. Payload ~= 300 KB

    payload=$(head -c $((1024 * 225)) /dev/urandom | base64 -w 0) && \
    echo "{\"pubsubTopic\": \"/waku/2/rs/0/0\", \"message\": {\"payload\": \"${payload}\", \"contentTopic\": \"/myapp/1/latest/proto\", \"timestamp\": 1712135330213797632}}" > /tmp/message_payload.json && \
    curl -v -X POST "http://127.0.0.1:56923/lightpush/v1/message" -H "Content-Type: application/json" -d @/tmp/message_payload.json

    Error is Failed to request a message push: Exception reading: Stream Remotely Closed! with 503 Service Unavailable

  2. Payload > 300 KB

    payload=$(head -c $((1024 * 250)) /dev/urandom | base64 -w 0) && \ \
    echo "{\"pubsubTopic\": \"/waku/2/rs/0/0\", \"message\": {\"payload\": \"${payload}\", \"contentTopic\": \"/myapp/1/latest/proto\", \"timestamp\": 1712135330213797632}}" > /tmp/message_payload.json && \
    curl -v -X POST "http://127.0.0.1:56923/lightpush/v1/message" -H "Content-Type: application/json" -d @/tmp/message_payload.json

Error is Push request timed out with 503 Service Unavailable light_push_node_that_sends_the_messages.log relay_node.log

gabrielmer commented 1 month ago

I was able to reproduce it. Seems that when sending such a large payload when using nwaku as a lightpush client, the request to the lightpush server doesn't go through.

Either the connection is dropped, or the request exceeds the lightpush client's REST server timeout.

In any case, such a large payload isn't allowed, as our max allowed is 150KiB.

gabrielmer commented 1 month ago

@fbarbu15 should we close this issue? or what exactly needs to happen in order for it to be resolved?

fbarbu15 commented 1 month ago

I would expect a more clear error, saying the payload is too big.

fbarbu15 commented 2 weeks ago

Fixed by https://github.com/waku-org/nwaku/pull/2695