GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Leaked socket in cache/internal/cacheHttpClient · Issue #1702 · actions/toolkit

Leaked socket in cache/internal/cacheHttpClient #1702

New issue
Copy link
New issue
Copy link
Open
Open
Leaked socket in cache/internal/cacheHttpClient#1702
Copy link
Labels
bugSomething isn't working

Description

@mweberxyz
mweberxyz
opened on Apr 4, 2024
Issue body actions

actions/cache#1217 attempted to work around a dangling socket, which became especially apparent when that action migrated to Node 20, as Node v20 started keeping connection alive by default.

This solution worked for actions/cache in the meantime, but caused downstream consumers of to implement the same logic to avoid hanging processes and generated similar issues, such as:

  • @actions/ccache causing 2min slowdown with Node 20 runtime #1643
  • Fix performance regression masci/datadog#33

The leaked socket originates in cache/src/internal/cacheHttpClient:

  const uploadChunkResponse = await retryHttpClientResponse(
    `uploadChunk (start: ${start}, end: ${end})`,
    async () =>
      httpClient.sendStream(
        'PATCH',
        resourceUrl,
        openStream(),
        additionalHeaders
      )
  )

sendStream return a response, the body of must be consumed to avoid holding the event loop open.

Something like the following ought to do it:

  const uploadChunkResponse = await retryHttpClientResponse(
    `uploadChunk (start: ${start}, end: ${end})`,
    async () => {
      const response = await httpClient.sendStream(
        'PATCH',
        resourceUrl,
        openStream(),
        additionalHeaders
      )

      await response.readBody()

      return response
    }
  )
Reacted by David Vo

Activity

  1. mweberxyz
    added
    bugSomething isn't working
    on Apr 4, 2024
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 working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.