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

Error: socket hang up don't return 1 #340

Closed
alanjaouen opened this issue Mar 11, 2020 · 17 comments
Closed

Error: socket hang up don't return 1 #340

alanjaouen opened this issue Mar 11, 2020 · 17 comments
Labels
bug Issue or pull request that identifies or fixes a bug

Comments

@alanjaouen
Copy link

Summary

When running a force:source:deploy in a CI context, some error can occured

ERROR: Error: socket hang up Unhandled rejection Error: socket hang up at createHangUpError (_http_client.js:323:15) at TLSSocket.socketOnEnd (_http_client.js:426:23) at TLSSocket.emit (events.js:194:15) at endReadableNT (_stream_readable.js:1125:12) at process._tickCallback (internal/process/next_tick.js:63:19)

Expected result

Return 1 so we can handle it's an error

Actual result

Return 0

Additional information

image

SFDX CLI Version(to find the version of the CLI engine run sfdx --version):

sfdx-cli/7.49.1-2b6ba86a25 linux-x64 node-v10.15.3

OS and version:

linux-x64

@clairebianchi clairebianchi added the bug Issue or pull request that identifies or fixes a bug label Mar 20, 2020
@clairebianchi
Copy link
Collaborator

@alanjaouen we are taking a look, thank you for reporting

@meo-tech
Copy link

meo-tech commented Feb 3, 2021

Got the same Error since some Days ago....

It should be the latest Version of sfdx, because it is part of our CI that the latest Version of sfdx will be downloaded for the Deployment...

[...]
ERROR: Error: socket hang up
Unhandled rejection Error: socket hang up
at connResetException (internal/errors.js:610:14)
at TLSSocket.socketOnEnd (_http_client.js:453:23)
at TLSSocket.emit (events.js:327:22)
at endReadableNT (_stream_readable.js:1220:12)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
[...]

Because it is unhandled, the CI Process tries to deploy further and further.... Then later at some Point the Timeout stops the Process.

@alanjaouen
Copy link
Author

got the same error today

ERROR: Error: socket hang up
Unhandled rejection Error: socket hang up
at connResetException (internal/errors.js:610:14)
at TLSSocket.socketOnEnd (_http_client.js:453:23)
at TLSSocket.emit (events.js:327:22)
at endReadableNT (_stream_readable.js:1220:12)
at processTicksAndRejections (internal/process/task_queues.js:84:21)

@meo-tech
Copy link

meo-tech commented Feb 5, 2021

Nobody assigned to this issue?

@clairebianchi as you wrote last year, that somebody will take a look at this issue... Are there any News for this?

Please don't get me wrong, but "sfdx" is quite essential for Salesforce Deployments.... Just wondering

@jamesmelville
Copy link

I've had similar errors twice today, and as others have reported, the job doesn't just not exit with failure, but looks like it hangs until some other timeout is hit.

Once with a force:source:push, which failed, but then just sat there until the 10m no output timeout on my circleCI job expired

ERROR:  Error: socket hang up
Unhandled rejection Error: socket hang up
    at connResetException (node:internal/errors:642:14)
    at TLSSocket.socketOnEnd (node:_http_client:486:23)
    at TLSSocket.emit (node:events:390:22)
    at endReadableNT (node:internal/streams/readable:1307:12)
    at processTicksAndRejections (node:internal/process/task_queues:81:21)

Too long with no output (exceeded 10m0s): context deadline exceeded

And once with an force:apex:test:run, which I think hung until the --wait timeout of 60m was hit (it didn't hit the circle CI no output timeout which is 60m).

ERROR:  Error: socket hang up
Unhandled rejection Error: socket hang up
    at connResetException (node:internal/errors:642:14)
    at TLSSocket.socketOnEnd (node:_http_client:486:23)
    at TLSSocket.emit (node:events:390:22)
    at endReadableNT (node:internal/streams/readable:1307:12)
    at processTicksAndRejections (node:internal/process/task_queues:81:21)

ERROR running force:apex:test:run:  Cannot read property 'message' of undefined
Unhandled rejection undefined

Version:

sfdx --version
sfdx plugins --core

sfdx-cli/7.86.3 linux-x64 node-v15.8.0
You acknowledge and agree that the CLI tool may collect usage information, user environment, and crash reports for the purposes of providing services or functions that are relevant to use of the CLI tool and product improvements.

You acknowledge and agree that the CLI tool may collect usage information, user environment, and crash reports for the purposes of providing services or functions that are relevant to use of the CLI tool and product improvements. 

@oclif/plugin-autocomplete 0.1.5 (core)
@oclif/plugin-commands 1.3.0 (core)
@oclif/plugin-help 3.2.2 (core)
@oclif/plugin-not-found 1.2.4 (core)
@oclif/plugin-plugins 1.9.5 (core)
@oclif/plugin-update 1.3.10 (core)
@oclif/plugin-warn-if-update-available 1.7.0 (core)
@oclif/plugin-which 1.0.3 (core)
@salesforce/sfdx-trust 3.6.0 (core)
alias 1.1.5 (core)
analytics 1.12.1 (core)
auth 1.4.7 (core)
config 1.2.4 (core)
generator 1.1.5 (core)
salesforcedx 50.16.1 (core)
├─ limits 1.0.3 (core)
├─ schema 1.0.3 (core)
├─ user 1.0.11 (core)
├─ apex 0.1.4 (core)
├─ templates 50.4.0 (core)
├─ @salesforce/sfdx-plugin-lwc-test 0.1.7 (core)
├─ custom-metadata 1.0.11 (core)
└─ salesforce-alm 50.16.1 (core)
sfdx-cli 7.86.3 (core)
telemetry 1.0.1 (core)

@thomasminney
Copy link

Getting the same error on sfdx force:mdapi:deploy:report:

ERROR:  Error: socket hang up
Unhandled rejection Error: socket hang up
    at connResetException (internal/errors.js:610:14)
    at TLSSocket.socketOnEnd (_http_client.js:453:23)
    at TLSSocket.emit (events.js:327:22)
    at endReadableNT (_stream_readable.js:1220:12)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)

As with others, this is crippling our Salesforce release pipeline. Whilst this had been happening occasionally in the past, since Spring '21 this has become an hourly occurrence.

@limlynette
Copy link

Encountered the socket hang up errors yesterday after installing the latest SFDX cli package.

This is the error encounter for sfdx force:source:retrieve. Similar errors for other sfdx commands like deploy.
It works sometimes but mostly errors out with below stacktrace.

Error:
socket hang up
at connResetException (internal/errors.js:610:14)
at TLSSocket.socketOnEnd (_http_client.js:453:23)
at TLSSocket.emit (events.js:327:22)
at endReadableNT (_stream_readable.js:1220:12)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
Outer stack:
at Function.wrap (/usr/local/lib/sfdx/node_modules/salesforce-alm/node_modules/@salesforce/core/lib/sfdxError.js:171:27)
at SourceRetrieveCommand.catch (/usr/local/lib/sfdx/node_modules/salesforce-alm/dist/ToolbeltCommand.js:248:46)
at async SourceRetrieveCommand._run (/usr/local/lib/sfdx/node_modules/@salesforce/command/lib/sfdxCommand.js:97:13)
at async Config.runCommand (/usr/local/lib/sfdx/node_modules/@oclif/config/lib/config.js:173:24)
at async Main.run (/usr/local/lib/sfdx/node_modules/@oclif/command/lib/main.js:27:9)
at async Main._run (/usr/local/lib/sfdx/node_modules/@oclif/command/lib/command.js:43:20)
at async Object.run (/usr/local/lib/sfdx/dist/cli.js:32:20)

This is my current SFDX CLI version.

sfdx --version
sfdx-cli/7.81.0-7b953c80d1 darwin-x64 node-v12.18.3

@pawel-id
Copy link

reported similar issue here #529 (comment)

@AndrewRayCode
Copy link

We hit the same issue with getaddrinfo ENOTFOUND

To be clear: The bug here is that sfdx returns a successful status code. Salesforce regularly has production DNS issues, it's an unstable system, so it's not the fault of sfdx if Salesforce misconfigures their DNS records.

It is a problem, however, that sfdx things a network error is a successful deploy.

@sxu575
Copy link

sxu575 commented May 12, 2021

Any update on this issue?

We are running force:source:deploy and issue is happening more frequently.

CLI Version: sfdx-cli/7.93.1-762bca056d linux-x64 node-v14.15.4

ERROR: Error: socket hang up
Unhandled rejection Error: socket hang up
at connResetException (internal/errors.js:607:14)
at TLSSocket.socketOnEnd (_http_client.js:493:23)
at TLSSocket.emit (events.js:327:22)
at endReadableNT (internal/streams/readable.js:1327:12)
at processTicksAndRejections (internal/process/task_queues.js:80:21)

@AndrewRayCode
Copy link

Salesforce regularly has production DNS issues

Wow this really hit home, given Salesforce took down their DNS globally for hours yesterday!

@shetzel
Copy link
Contributor

shetzel commented May 17, 2021

W-6835454 for internal tracking.

@AndrewRayCode
Copy link

Hmm, I now propose this issue be closed. I don't think most people replying to this issue understand that this isn't an sfdx issue. Instead I propose two new tickets:

  1. Make sfdx have a more descriptive error message during network communication issues, so you don't get tickets like this where people think it's an sfdx issue
  2. Fix sfdx to report an error status code on network communication issues

@pawel-id
Copy link

oh, network problems happens, but this is definitely sfdx issue with handling this situation. 'Unhandled rejection" - this shouldn't happen. This should be handled properly by sfdx. And of course the return code should indicate error (i.e. non zero)

Hmm, I now propose this issue be closed. I don't think most people replying to this issue understand that this isn't an sfdx issue. Instead I propose two new tickets:

  1. Make sfdx have a more descriptive error message during network communication issues, so you don't get tickets like this where people think it's an sfdx issue
  2. Fix sfdx to report an error status code on network communication issues

@uip-robot-zz
Copy link

This issue has been linked to a new work item: W-9299373

@shetzel
Copy link
Contributor

shetzel commented Sep 28, 2021

Using the old version of the force:source:deploy command from the salesforce-alm plugin I could reproduce this by starting a deploy, then killing the network connection. With the new version of the command in the source plugin I could not reproduce this in the same way; the command returned an exit code of 1.

I also tested with a very low command wait time (1 minute) and the command exited with a timeout error and an exit code of 1.

@shetzel shetzel closed this as completed Sep 28, 2021
@AndrewRayCode
Copy link

Please reopen this ticket. We're getting this repeatedly. sfdx is notoriously poor at reporting status codes, I suggest an audit of all exits of sfdx.

This is from salesforce/salesforcedx:7.177.0-slim

ERROR:  Error: socket hang up
Unhandled rejection Error: socket hang up
    at connResetException (internal/errors.js:609:14)
    at TLSSocket.socketOnEnd (_http_client.js:453:23)
    at TLSSocket.emit (events.js:327:22)
    at endReadableNT (_stream_readable.js:1221:12)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)

great, tests pass!

sfdx is a dangerous tool, the output can't be trusted

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue or pull request that identifies or fixes a bug
Projects
None yet
Development

No branches or pull requests