Haunting EPIPE errors
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Accessibilité débutants
- 25/100
- Type d'issue
- Bug
- Clarté
- À clarifier
- Activité
- À l'abandon
- Stack technique
- javascript, node.js
- Domaine
- backend, networking
Piste de recherche
Commencez dans web-incoming.js, en particulier dans la gestion du socket de proxyReq et ses méthodes _write et _writev. Reproduisez la réponse 401 de HAProxy avec un corps POST volumineux et observez le chemin EPIPE. C’est terminé lorsque l’erreur de l’upstream peut atteindre le client sans que l’instance node-http-proxy ne s’arrête ni ne renvoie parfois une réponse vide.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Hello, I have node-http-proxy proxying HTTP POST requests with big payload (MBs) to upstream haproxy which upon 401 (Unauthorized) error responds early without reading the body and closes connection. This causes EPIPE error in node-http-proxy, no response is returned to the client and the whole node-http-proxy instance shuts down. I need to return the error from haproxy to the client.
I'm trying to ignore EPIPE errors by monkey-patching _write and _writev methods on proxyReq socket in web-incoming.js
...
// Enable developers to modify the proxyReq before headers are sent
proxyReq.on('socket', function(socket) {
const socketWriteOrig = socket._write;
socket._write = (data, encoding, callback) => {
return socketWriteOrig.call(socket, data, encoding, (err) => {
if(err && err.code == 'EPIPE') {
if(callback) callback();
return;
}
if(callback) callback(err); else throw err;
});
}
const socketWritevOrig = socket._writev;
socket._writev = (data, callback) => {
return socketWritevOrig.call(socket, data, (err) => {
if(err && err.code == 'EPIPE') {
if(callback) callback();
return;
}
if(callback) callback(err); else throw err;
});
}
if(server && !proxyReq.getHeader('expect')) {
server.emit('proxyReq', proxyReq, req, res, options);
}
});
...
This "patch" improves the behaviour of node-http-proxy a lot, but still I occasionally get empty response.
Any ideas how to handle EPIPE correctly or improve my "monkey-patch"?
Here is my node-http-proxy instance:
httpProxy
.createProxyServer({target:'http://localhost:8008',xfwd:false,ws:true})
.listen(8007);
- Langage dominant
- JavaScript
- Étoiles
- 14.1k
- Forks
- 2k
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Préparer son environnement
Ce projet ne fournit ni conteneur de développement, ni Dockerfile, ni guide de contribution : l'installation est à votre charge. Commencez par son README, et consultez notre guide de la première contribution pour les étapes générales.
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de http-party/node-http-proxy
-
util._extend() is depracatoryOuverte
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
http-party/node-http-proxy#1719 ·
-
Difficulté 3/5 1-2 jours Accessibilité débutants 72/100
http-party/node-http-proxy#1721 · 1 commentaire ·
-
Difficulté 1/5 Moins d'une heure Accessibilité débutants 55/100
http-party/node-http-proxy#1715 · 1 commentaire · 5 réactions ·
-
Is this library is dead?Ouverte
Difficulté 1/5 Moins d'une heure Accessibilité débutants 15/100
http-party/node-http-proxy#1711 · 2 commentaires ·
-
HTTP3 + QUIC support?Ouverte
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 25/100
http-party/node-http-proxy#1710 · 5 réactions ·
Toutes les issues de http-party/node-http-proxy
Issues similaires
-
[docs] RELEASE.md: wrong branch name, no check that the prepare PR merged with the right subject, manual publish stepPeut-être pris @albertteoh l’a pris aujourd’hui. Ouvertedocumentation
Difficulté 2/5 1-3 heures Accessibilité débutants 85/100
jaegertracing/jaeger-ui#4739 ·
Les mainteneurs répondent en général sous 1 jour
-
documentation
Difficulté 2/5 1-3 heures Accessibilité débutants 74/100
keepassxreboot/keepassxc-browser#3159 · 1 commentaire ·
-
Add: ESP 2 RSOuverteapproved check:passed feeds:add
Difficulté 1/5 Moins d'une heure Accessibilité débutants 67/100
-
v6: OTP input keeps the rest of a selection when you type over itPeut-être pris @thejesh23 l’a pris aujourd’hui. Ouvertebug confirmed has-pr js v6
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
twbs/bootstrap#43323 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
Les mainteneurs répondent en général sous 1 jour