HTML5 Build crashes after 7 minutes with "RuntimeError: integer overflow"

Hello everybody,

I noticed that when you package a game for HTML5 (Shipping) after a couple of minutes it crashes and gives this error:

The time until the error occurs is roughly always the same (around 7 minutes of running). What could cause this?

I use the 4.17 build and packaged a fresh project with the starter content and the map “Minimal_Default”.
The same happens in the promoted branch on GitHub (4.19).

Below the launcher profile:

{
	"Version": 25,
	"Id": "",
	"Name": "HTML5PROD",
	"Description": "",
	"BuildConfiguration": 4,
	"ProjectSpecified": false,
	"ShareableProjectPath": "C:/Users//Documents/Unreal Projects/BinaryExample/BinaryExample.uproject",
	"CookConfiguration": 4,
	"CookIncremental": false,
	"CookOptions": "",
	"CookMode": 1,
	"CookUnversioned": true,
	"CookedCultures": [
		"en"
	],
	"CookedMaps": [
		"Minimal_Default"
	],
	"CookedPlatforms": [
		"HTML5"
	],
	"DeployStreamingServer": false,
	"DeployWithUnrealPak": true,
	"DeployedDeviceGroupId": "B459B7844DBFE2EA60668E9E9600B2E9",
	"DeploymentMode": 0,
	"HideFileServerWindow": false,
	"LaunchMode": 0,
	"PackagingMode": 1,
	"PackageDir": "",
	"BuildGame": true,
	"ForceClose": true,
	"Timeout": 60,
	"Compressed": true,
	"EncryptIniFiles": false,
	"ForDistribution": false,
	"DeployPlatform": "None",
	"NumCookersToSpawn": 0,
	"SkipCookingEditorContent": true,
	"DeployIncremental": false,
	"GeneratePatch": false,
	"AddPatchLevel": false,
	"StageBaseReleasePaks": false,
	"DLCIncludeEngineContent": false,
	"CreateReleaseVersion": true,
	"CreateReleaseVersionName": "",
	"BasedOnReleaseVersionName": "",
	"CreateDLC": false,
	"DLCName": "",
	"GenerateChunks": false,
	"GenerateHttpChunkData": false,
	"HttpChunkDataDirectory": "",
	"HttpChunkDataReleaseName": "",
	"Archive": true,
	"ArchiveDirectory": "C:/xampp/htdocs/",
	"DefaultRole":
	{
		"AssignedDevice": "",
		"CommandLine": "",
		"DeviceId": "",
		"InitialCulture": "en",
		"InitialMapName": "",
		"Name": "DefaultRole",
		"InstanceType": 2,
		"VsyncEnabled": false
	},
	"scripts": [
		{
			"script": "BuildCookRun",
			"project": "",
			"noP4": true,
			"nocompile": false,
			"nocompileeditor": false,
			"ue4exe": "UE4Editor-Cmd.exe",
			"usedebugparamforeditorexe": false,
			"utf8output": true,
			"clientconfig": [
				"Shipping"
			],
			"serverconfig": [
				"Shipping"
			],
			"platform": [
				"HTML5"
			],
			"cmdline":
			{
				"": "Minimal_Default",
				"messaging": true
			},
			"device": [],
			"addcmdline":
			{
				"sessionid": "6A6F36744A4F5196C3F03C825DB7A86C",
				"sessionowner": "",
				"sessionname": "HTML5PROD"
			},
			"map": [
				"Minimal_Default"
			],
			"build": true,
			"cook": true,
			"unversionedcookedcontent": true,
			"pak": true,
			"createreleaseversion": "",
			"generatepatch": false,
			"manifests": false,
			"archive": true,
			"archivedirectory": "C:/xampp/htdocs/",
			"iterativecooking": false,
			"iteratesharedcookedbuild": false,
			"skipcookingeditorcontent": true,
			"compressed": true,
			"EncryptIniFiles": false,
			"ForDistribution": false,
			"stage": true,
			"package": true
		}
	]
}

Try doing a Development build (in WebAssembly, not in asm.js), and then open the web page console after the page throws the exception, and see if you can locate a call stack of the exception in question. The callstack should be able to help pinpoint to the root cause of the issue.

If you are building UE4 manually from source, you may be able to workaround the issue (effectively hide it under the rug) by going to HTML5ToolChain.cs, and removing the line where it says about -s OUTLINING_LIMIT, and add a directive -s BINARYEN_TRAP_MODE=clamp there instead. This will not fix the problem, but can potentially make the build continue through even when the error occurs. (That might or might not work out well, depending on what the actual cause of the error turns out to be)

I am unable to add a comment since there is no button to do so, so I’ll post the stacks here:

Firefox:

At start:

Error: WebGL warning: checkFramebufferStatus: Framebuffer not complete. (status: 0x8cd7) 
Error: WebGL warning: clearBufferfv: Framebuffer not complete. (status: 0x8cd7)  
Error: WebGL: No further warnings will be reported for this WebGL context. (already reported 32 warnings)

After a few minutes:

exception thrown: RuntimeError: integer overflow,__ZN9FTimespan11FromSecondsEd@http://localhost:8000//RealisticRendering-HTML5-DebugGame.html:36395095:1
__ZN19FAppMediaTimeSource11GetTimecodeEv@http://localhost:8000//RealisticRendering-HTML5-DebugGame.html:41095604:1
__ZN12FMediaModule13TickPreEngineEv@http://localhost:8000//RealisticRendering-HTML5-DebugGame.html:34472406:1
__ZN11FEngineLoop4TickEv@http://localhost:8000//RealisticRendering-HTML5-DebugGame.html:2171488:1
__Z10HTML5_Tickv@http://localhost:8000//RealisticRendering-HTML5-DebugGame.html:37566002:1
dynCall_v@http://localhost:8000//RealisticRendering-HTML5-DebugGame.html:41431768:1
Module.dynCall_v@blob:http://localhost:8000/45ff80de-00b8-4f65-99e2-0702f25540eb:1:967006
browserIterationFunc@blob:http://localhost:8000/45ff80de-00b8-4f65-99e2-0702f25540eb:1:116337

Chrome:

At start:

[.Offscreen-For-WebGL-000001F2DBEBA6D0]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : glDrawElements: framebuffer incomplete
4RealisticRendering-HTML5-DebugGame.html:1 [.Offscreen-For-WebGL-000001F2DBEBA6D0]GL ERROR :GL_INVALID_OPERATION : glUniform4uiv: wrong uniform function for type
RealisticRendering-HTML5-DebugGame.html:1 WebGL: too many errors, no more errors will be reported to the console for this context.

After a few minutes:

exception thrown: RuntimeError: integer result unrepresentable,RuntimeError: integer result unrepresentable
    at __ZN9FTimespan11FromSecondsEd (wasm-function[79412]:46)
    at __ZN19FAppMediaTimeSource11GetTimecodeEv (wasm-function[195354]:9)
    at __ZN12FMediaModule13TickPreEngineEv (wasm-function[59330]:75)
    at __ZN11FEngineLoop4TickEv (wasm-function[699]:10038)
    at __Z10HTML5_Tickv (wasm-function[99983]:67)
    at dynCall_v (wasm-function[211928]:12)
    at Object.Module.dynCall_v (blob:http://localhost:8000/363c63de-0255-44e0-b089-14a517250936:1:967033)
    at browserIterationFunc (blob:http://localhost:8000/363c63de-0255-44e0-b089-14a517250936:1:116356)
    at Object.runIter (blob:http://localhost:8000/363c63de-0255-44e0-b089-14a517250936:1:119448)
    at Browser_mainLoop_runner (blob:http://localhost:8000/363c63de-0255-44e0-b089-14a517250936:1:117891)

error: Uncaught RuntimeError: integer result unrepresentable

Uncaught RuntimeError: integer result unrepresentable
    at __ZN9FTimespan11FromSecondsEd (wasm-function[79412]:46)
    at __ZN19FAppMediaTimeSource11GetTimecodeEv (wasm-function[195354]:9)
    at __ZN12FMediaModule13TickPreEngineEv (wasm-function[59330]:75)
    at __ZN11FEngineLoop4TickEv (wasm-function[699]:10038)
    at __Z10HTML5_Tickv (wasm-function[99983]:67)
    at dynCall_v (wasm-function[211928]:12)
    at Object.Module.dynCall_v (blob:http://localhost:8000/363c63de-0255-44e0-b089-14a517250936:1:967033)
    at browserIterationFunc (blob:http://localhost:8000/363c63de-0255-44e0-b089-14a517250936:1:116356)
    at Object.runIter (blob:http://localhost:8000/363c63de-0255-44e0-b089-14a517250936:1:119448)
    at Browser_mainLoop_runner (blob:http://localhost:8000/363c63de-0255-44e0-b089-14a517250936:1:117891)

The line __ZN9FTimespan11FromSecondsEd traces back to an issue that was debugged out a couple of weeks ago. The root cause is reported to upstream Emscripten at Splitting double to 2xint32 parts in asm.js compatibility causes a wasm trap · Issue #5574 · emscripten-core/emscripten · GitHub.

To work around the issue, if one is building UE4 from source, removing -s OUTLINING_LIMIT in HTML5ToolChain.cs will fix the problem. I believe this fix should already be in trunk UE4 code, and be included in next release.

Hey mate, I know is an old post but when i export to html5 and run it on chrome i get this error:
Uncaught Error at Array.ASM_CONSTS (blob:http://localhost:8000/16ca2c93-cf14-4df6-a97e-051c5ff1ea1a:1179:18) at _emscripten_asm_const_i (blob:http://localhost:8000/16ca2c93-cf14-4df6-a97e-051c5ff1ea1a:1303:25) at __ZN17FOpenGLDynamicRHI38RHICreateBoundShaderState_OnThisThreadEP21FRHIVertexDeclarationP16FRHIVertexShaderP14FRHIHullShaderP16FRHIDomainShaderP15FRHIPixelShaderP18FRHIGeometryShaderb (wasm-function[28677]:0x109b2c6) at __ZN17FOpenGLDynamicRHI34RHICreateBoundShaderState_internalEP21FRHIVertexDeclarationP16FRHIVertexShaderP14FRHIHullShaderP16FRHIDomainShaderP15FRHIPixelShaderP18FRHIGeometryShaderb (wasm-function[28062]:0x104c64b) at __ZN17FOpenGLDynamicRHI27RHISetGraphicsPipelineStateEP25FRHIGraphicsPipelineState (wasm-function[28010]:0x104b91c) at __ZThn16_N17FOpenGLDynamicRHI27RHISetGraphicsPipelineStateEP25FRHIGraphicsPipelineState (wasm-function[28027]:0x104bde9) at __ZN11FRHICommandI35FRHICommandSetGraphicsPipelineState45FRHICommandSetGraphicsPipelineStateString1296E18ExecuteAndDestructER19FRHICommandListBaseR27FRHICommandListDebugContext (wasm-function[29329]:0x110faf0) at __ZN23FRHICommandListExecutor22ExecuteInner_DoExecuteER19FRHICommandListBase (wasm-function[29106]:0x10d614a) at __ZN21FExecuteRHIThreadTask6DoTaskEN13ENamedThreads4TypeERK12TRefCountPtrI11FGraphEventE (wasm-function[29111]:0x10d6a1a) at __ZN10TGraphTaskI21FExecuteRHIThreadTaskE11ExecuteTaskER6TArrayIP14FBaseGraphTask22TSizedDefaultAllocatorILi32EEEN13ENamedThreads4TypeE (wasm-function[29110]:0x10d66a3)
Uncaught RuntimeError: float unrepresentable in integer range
Uncaught RuntimeError: float unrepresentable in integer range
Uncaught RuntimeError: float unrepresentable in integer range
Uncaught RuntimeError: float unrepresentable in integer range
Uncaught RuntimeError: float unrepresentable in integer range

Do you know how to fix it? Please :frowning: