haxball / haxball-issues

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Expiring tokens + likely memory leak + error code 9

sefinek24 opened this issue · comments

Hello. To begin with, it might be worth noting that I am using the latest version of Puppeteer with the following configuration:

await puppeteer.launch({
	headless: false,
	devtools: NODE_ENV === 'development',
	args: [
		'--no-sandbox',
		'--disable-setuid-sandbox',
		'--disable-infobars',
		'--disable-extensions',
		'--disable-gpu',
		`--window-size=${NODE_ENV === 'production' ? '900,700' : '1500,760'}`
	],
});
  1. Unfortunately, I often encounter an issue where the headless tokens expire for some reason, preventing me from setting the headless mode to true in the launch() function to solve captchas. Generating new tokens every about 6 hours is tiresome. The token is used continuously on the same IP address, so I really have no idea why it loses its validity.

  2. Another problem is likely a memory leak. I often see an OUT_OF_MEMORY error, which occurs on both 2 VPS servers (Linux Ubuntu 20.04.6) and on my workstation (Windows 10 22H2). After the aforementioned error occurred, I checked the task manager and there was 5GB of free memory on my PC. So, I really do not understand what is going on. As for the Linux VPS, my haxball servers occasionally crash due to this error. Not only do I have to restore them, but I also have to perform a captcha because, for some reason, the token stopped working.
    image

    Linux often throws a SIGTERM error code 9 in Chrome Puppeteer. Does anyone know what this might be about?
    image

Thanks!

headless tokens expire for some reason

They're expiring in a 10 minutes by a design. Maybe not 10 minutes, but something around it

OUT_OF_MEMORY error, which occurs on both 2 VPS servers (Linux Ubuntu 20.04.6) and on my workstation (Windows 10 22H2). After the aforementioned error occurred, I checked the task manager and there was 5GB of free memory

I have no idea what could be the reason of this. Also this was never a problem for anyone judging by all the haxball issues. Worth to mention that it is doesn't makes sense to check the free memory after the error because the memory is probably would be cleared right after the error message. Make sure you don't have this problem with a purest room possible, then just find a culprit by a process of elimination. I'm using an old "puppeteer": "14.1.2". My args:

[
    '--start-maximized',
    '--no-sandbox',
    '--disable-setuid-sandbox',
    '--disable-features=WebRtcHideLocalIpsWithMdns',
    '--disable-client-side-phishing-detection',
    '--disable-component-extensions-with-background-pages',
    '--disable-default-apps',
    '--disable-extensions',
    '--mute-audio',
    '--no-default-browser-check',
    '--no-first-run',
    '--disable-hang-monitor',
    '--disable-notifications',
    '--disable-device-discovery-notifications',
    '--disable-background-networking',
    '--disable-breakpad',
    '--disable-component-update',
    '--disable-domain-reliability',
    '--disable-sync',
    '--metrics-recording-only',
    '--disable-desktop-notifications',
    '--in-process-gpu',
    '--no-zygote',
]

Most of them I've included for no reason, I just thought this would reduce a memory consumption, but it seems it doesn't do much. In production I'm also using '--single-process' but it is bad for debugging because it is breaking something related to a debugger. I also remember that some args that I didn't include here were as well breaking something important (or maybe everything) so I skipped them when I did this list. In your case this might be '--disable-gpu' causing problems.

See also how the most popular haxball rooms runner is creating a puppeteer browser: https://github.com/morko/haxroomie/blob/95539ca0201b924aa73cdc30d3a7d1e20bb57258/packages/haxroomie-core/src/Haxroomie.js#L116
It is also using a deprecated version (^13.1.2 -> 13.7.0), even more deprecated than I have

Thanks for your answer

They're expiring in a 10 minutes by a design. Maybe not 10 minutes, but something around it

In that case, I wonder what the tokens are even for. They seem useless

Worth to mention that it is doesn't makes sense to check the free memory after the error because the memory is probably would be cleared right after the error message.

Yep, I know

My args:

I used the configuration you sent me, we'll see how it performs now.

const browser = await puppeteer.launch({
	headless: false,
	devtools: NODE_ENV === 'development',
	userDataDir: path.resolve(__dirname, 'ChromeData'),
	args: [
		'--no-sandbox',
		'--disable-setuid-sandbox',
		'--disable-infobars',
		'--disable-extensions',
		`${NODE_ENV === 'production' ? '--start-maximized' : '--window-size=1400,800'}`,
		'--disable-features=WebRtcHideLocalIpsWithMdns',
		'--disable-client-side-phishing-detection',
		'--disable-component-extensions-with-background-pages',
		'--disable-default-apps',
		'--mute-audio',
		'--no-default-browser-check',
		'--no-first-run',
		'--disable-hang-monitor',
		'--disable-notifications',
		'--disable-device-discovery-notifications',
		'--disable-background-networking',
		'--disable-breakpad',
		'--disable-component-update',
		'--disable-domain-reliability',
		'--disable-sync',
		'--metrics-recording-only',
		'--disable-desktop-notifications',
		'--in-process-gpu',
		'--no-zygote',
	],
});

I wonder what the tokens are even for. They seem useless

To reduce amount of a spam rooms like these

image

The --in-process-gpu argument caused me problems on Ubuntu Server. The game server wouldn't start at all; the node.js process would immediately throw an error.

As for tokens, after all, there can only be a maximum of 2 rooms from one IP address