microsoft / playwright

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
https://playwright.dev
Apache License 2.0
66.36k stars 3.63k forks source link

[BUG] WebKit NetworkProcess CPU 100% when Socks Reply is != successful #6613

Closed mxschmitt closed 3 years ago

mxschmitt commented 3 years ago
const playwright = require('.');

(async () => {
  for (const browserType of ['webkit']) {
    const browser = await playwright[browserType].launch({
      headless: false
    });
    const context = await browser.newContext({
      proxy: {
        server: "socks://localhost:1080"
      }
    });
    const page = await context.newPage();
    await page.goto('http://whatsmyuseragent.org/'); // hangs
    await browser.close();
  }
})();
var socks = require('socksv5');

var srv = socks.createServer(function(info, accept, deny) {
  console.log('request', info);
  deny();
});
srv.listen(1080, 'localhost', function() {
  console.log('SOCKS server listening on port 1080');
});

srv.useAuth(socks.auth.None());

When using this example, it leads to CPU 100% of the WebKit network process. For Firefox and Chromium it's fine, they will say to me that the Socket connection could not be established.

Upstream issue: https://gitlab.gnome.org/GNOME/glib/-/issues/2411

mxschmitt commented 3 years ago

Closing since it seems the socksv5 NPM module sent incorrect replies. With the custom implementation it works as expected.