filecoin-station / zinnia

Runtime for worker nodes executing modules in a resource-limited sandbox
https://crates.io/crates/zinnia
Other
19 stars 2 forks source link

Streams error in `deno_web` #495

Open juliangruber opened 8 months ago

juliangruber commented 8 months ago
error: Uncaught (in promise) Error: request or response body error: error reading a body from connection: unexpected end of file
    at async Object.pull (ext:deno_web/06_streams.js:942:27)

Unfortunately the stack trace doesn't contain more information. Do you happen to know more about this error?

bajtos commented 8 months ago

When Lassie discovers a verification problem after it already started streaming the CAR response body, it needs to let the client know about the problem. The current solution is to abort the stream in a way that breaks the HTTP/1.1 protocol.

The error message seems to describe this error condition.

error reading a body from connection: unexpected end of file

I see two ways forward:

  1. Detect this particular error and handle it differently
  2. https://github.com/filecoin-station/spark/issues/46
bajtos commented 8 months ago

Detect this particular error and handle it differently

As part of Zinnia-Lassie integration, we can detect this error condition and wrap or annotate the error instance with a code that will make it easier for Station modules to detect this particular error.

Either way, we need to modify Spark Checker node to detect & handle this error in a special way.

I propose introducing a new "retrieval result" value - "verification failed". IIRC, we don't have any existing "measurement" field to accommodate this new flag/status. We need to think a bit more about this.

juliangruber commented 8 months ago

Do you know how we can catch this error?

I agree that if we continue using Lassie, wrapping this error message is the way to go, to give the user more useful context.

This is also happening with Voyager btw (and this particular error message is from Voyager), which doesn't use Zinnia's Lassie integration

bajtos commented 8 months ago

Do you know how we can catch this error?

I would expect something like this to work:

try {
  await fetch(/*...*/);
} catch (err) {
  if (err.message === 'request or response body error: error reading a body from connection: unexpected end of file') {
    // this error was triggered
  } else {
    throw err;
  }
}

This is also happening with Voyager btw (and this particular error message is from Voyager), which doesn't use Zinnia's Lassie integration

Interesting! Doesn't Saturn L1 use Lassie under the hood to retrieve the content from the upstream provider?