Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deno panickes serving some HTTP requests with Deno.serve(). #21250

Closed
oscarotero opened this issue Nov 18, 2023 · 3 comments · Fixed by #21252
Closed

Deno panickes serving some HTTP requests with Deno.serve(). #21250

oscarotero opened this issue Nov 18, 2023 · 3 comments · Fixed by #21252
Labels
bug Something isn't working correctly ext/http related to ext/http

Comments

@oscarotero
Copy link

It happens with Deno 1.38.2 (macOS)
Deno 1.38.1 works fine.

This is the full backtrace:

============================================================
Deno has panicked. This is a bug in Deno. Please report this
at https://github.com/denoland/deno/issues/new.
If you can reliably reproduce this panic, include the
reproduction steps and re-run with the RUST_BACKTRACE=1 env
var set and include the backtrace in your report.

Platform: macos x86_64
Version: 1.38.2
Args: ["/Users/oscarotero/.deno/bin/deno", "run", "--unstable", "-A", "-", "-s"]

thread 'main' panicked at ext/http/service.rs:255:5:
HTTP state error: Expected to be last strong reference
stack backtrace:
   0:        0x103f65cf1 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h65343ad3a85b4e34
   1:        0x1030b2cbb - core::fmt::write::h11839d3825cb5605
   2:        0x103f3277e - std::io::Write::write_fmt::h3ab12d369399333c
   3:        0x103f6b589 - std::sys_common::backtrace::print::h405f7c76ca12eb27
   4:        0x103f6b1b5 - std::panicking::default_hook::{{closure}}::hed87c355606e1822
   5:        0x103f6ae7f - std::panicking::default_hook::hdf696ec8ea0d65aa
   6:        0x102f15b9d - deno::setup_panic_hook::{{closure}}::h7cfd1dfb3b898f8e
   7:        0x103f6be79 - std::panicking::rust_panic_with_hook::h7c5059af1af54377
   8:        0x103f6bc07 - std::panicking::begin_panic_handler::{{closure}}::hd658b0e1cffe3d4d
   9:        0x103f6bb99 - std::sys_common::backtrace::__rust_end_short_backtrace::h3d7834d0cea60a50
  10:        0x103f6bb82 - _rust_begin_unwind
  11:        0x105604123 - core::panicking::panic_fmt::ha9964785de0afb40
  12:        0x103464c07 - deno_http::service::HttpRecord::recycle::h18b58f156186a7c9
  13:        0x10350a9b6 - <futures_util::future::future::Map<Fut,F> as core::future::future::Future>::poll::hdd029f411d3bf98f
  14:        0x103509735 - deno_http::http_next::op_http_set_response_body_resource::v8_fn_ptr::h243bdcfe07ad50e4
@oscarotero oscarotero changed the title Deno panicks serving some HTTP requests with Deno.serve(). Deno panickes serving some HTTP requests with Deno.serve(). Nov 18, 2023
@mmastrac
Copy link
Contributor

@oscarotero Thanks for the report. Does your response handler return a stream in this case? (ie: a file, or a streaming response from fresh, etc)

Is it happening when you refresh in the browser?

@mmastrac mmastrac added bug Something isn't working correctly ext/http related to ext/http labels Nov 18, 2023
@mmastrac
Copy link
Contributor

I can reproduce this by dropping a TCP connection before the response is returned.

@oscarotero
Copy link
Author

oscarotero commented Nov 18, 2023

@mmastrac I don't know. I'm serving a complete site with html files, images, etc. I couldn't tell which of these responses causes the panick.

mmastrac added a commit that referenced this issue Nov 18, 2023
Fixes #21250

We were attempting to recycle dropped resource responses too early.
mmastrac added a commit that referenced this issue Nov 18, 2023
Fixes #21250

We were attempting to recycle dropped resource responses too early.
zifeo pushed a commit to metatypedev/deno that referenced this issue Nov 22, 2023
Fixes denoland#21250

We were attempting to recycle dropped resource responses too early.
bartlomieju pushed a commit that referenced this issue Nov 24, 2023
Fixes #21250

We were attempting to recycle dropped resource responses too early.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly ext/http related to ext/http
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants