KalebDark / angleproject

Automatically exported from code.google.com/p/angleproject
Other
0 stars 0 forks source link

Infinite loop in shader causes system hang #924

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Have a shader with this loop in it: for (int x = 0; x >= 0; x++) ;
2. Run the page.

What is the expected output? What do you see instead?
The compiler should catch this and compilation should fail.
Instead my system hangs.

What version of the product are you using? On what operating system?
The last time we updated ANGLE for our build was may of last 2014. Perhaps this 
has been fixed already...

Please provide any additional information below.

Original issue reported on code.google.com by roger.d....@gmail.com on 19 Feb 2015 at 6:25

GoogleCodeExporter commented 9 years ago
Infinite loop detection isn't actually part of the ESSL spec. In fact, even 
enforcement of properly formed for loop conditions (e.g., rejection of 
"for(;;)") is optional in ES 2.0 (and ANGLE does support these optional 
restrictions). For WebGL, responsibility for protecting the system against 
infinite loops falls to the browser/WebGL implementation level; Chrome and 
Firefox handle this by using a watchdog to monitor the GPU process/thread for 
calls that don't return after a certain time, and then forcibly kill the 
process. 

Are you running into this with a browser, or do you have a different sort of 
build?

Original comment by shannonw...@chromium.org on 20 Feb 2015 at 5:50

GoogleCodeExporter commented 9 years ago
Ah-- is this a WebKit issue?

Original comment by shannonw...@chromium.org on 20 Feb 2015 at 5:51

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
As Shannon said, it's not an ANGLE job to detect if programs complete. Even as 
a browser-level project, if you wanted use ANGLE to detect infinite or very 
slow programs, it's tough without actually running the program.

You might be able to do something if you limit loops in certain ways, but 
iteration count can depend on uniforms, attributes, or texture lookups. It's 
certainly not impossible, but it's a large, challenging piece of work, that's 
already solved by the watchdog process Shannon mentioned.

Original comment by jmad...@chromium.org on 20 Feb 2015 at 6:10