Skip to content

error message with Bun.serve for EACCESS is shown as EADDRINUSE #7187

Closed

Description

@small-angel

What version of Bun is running?

No response

What platform is your computer?

Linux

What steps can reproduce the bug?

Bun.serve({ fetch(){}, port: 1003 });

What is the expected behavior?

EACCES: permission denied 0.0.0.0:1003

What do you see instead?

EADDRINUSE: Failed to start server. Is port 1003 in use?

Additional information

i think this is an easy fix. grep for this string to see where listen failures are handled

noinline fn onListenFailed(this: *ThisServer) void {

grep this line for where i think we start listening
this.app.listenWithConfig(*ThisServer, this, onListen, .{

bun.serve is defined in src/bun.js/api/bun.zig by
pub fn serve(

Activity

  1. added
    bugSomething isn't working
    good first issueSomething that would be good for new contributors
    linuxAn issue that occurs on Linux
    on Nov 17, 2023
  2. liz3 commented on Nov 17, 2023

    @liz3
    Contributor

    I don't actually think that this is very easy, because we have no indication of why the socket creation failed, i spend some time looking into this and this goes deep into usockets. the zig side only gets: "we failed to allocate the socket".

    Implementing this requires passing up the error which actually occurs.

  3. small-angel commented on Nov 17, 2023

    @small-angel
    ContributorAuthor

    my bad then, removed gfi tag

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinglinuxAn issue that occurs on Linux

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions