Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failure when using in more than one jest suite #449

Closed
swistak35 opened this issue Mar 30, 2019 · 6 comments
Closed

Failure when using in more than one jest suite #449

swistak35 opened this issue Mar 30, 2019 · 6 comments

Comments

@swistak35
Copy link
Contributor

I've added a usage of GPU.js to my code and found out that some of my tests started to fail. It looks that only the first jest suite is behaving correctly in tests, and the subsequent ones, despite the cleanup, are failing with error:

    TypeError: framebufferTexture2D(GLenum, GLenum, GLenum, WebGLTexture, GLint)

      3 | describe("Suite2", () => {
      4 |   it('test', () => {
    > 5 |     const gpu = new GPU()
        |                 ^
      6 |     gpu.destroy()
      7 |   })
      8 | })

      at WebGLRenderingContext.framebufferTexture2D (node_modules/gl/webgl.js:2570:11)
      at resizeDrawingBuffer (node_modules/gl/webgl.js:4476:27)
      at Object.allocateDrawingBuffer (node_modules/gl/webgl.js:4459:3)
      at createContext (node_modules/gl/node_index.js:105:9)
      at Function.setupFeatureChecks (node_modules/gpu.js/src/backend/headless-gl/kernel.js:25:17)
      at Function.get isSupported [as isSupported] (node_modules/gpu.js/src/backend/headless-gl/kernel.js:16:8)
      at GPU.chooseKernel (node_modules/gpu.js/src/gpu.js:175:24)
      at new GPU (node_modules/gpu.js/src/gpu.js:120:8)
      at Object.it (test2.test.js:5:17)

I've reproduced it only in Jest for now. Also, note that there can be multiple instances of GPU in one jest suite and it works just fine, the problem is to create GPU.js instance in two different suites. I'm not sure what exactly jest is using internally (some threads maybe?), but it would be nice to get some guidelines how to fix that.

I've prepared minimal reproduction repository here: https://github.com/swistak35/gpu-js-fail-example

@robertleeplummerjr
Copy link
Member

What is the test runner you are using?

@swistak35
Copy link
Contributor Author

A default one, jasmine2.

@robertleeplummerjr
Copy link
Member

I believe this to be the culprit: tensorflow/tfjs#540
Would you be in a position to try out: tensorflow/tfjs#540 (comment) ?

@swistak35
Copy link
Contributor Author

We were already using testEnvironment: "node". I can add that to the example repository because it's not reflected in it, but that doesn't fix the issue.

@swistak35
Copy link
Contributor Author

After a little bit longer investigation, it seems that headless-gl and jest have already a history of not liking each other: jestjs/jest#2029 (the suggested workaround, --no-cache, didn't help me, but still, the issue was there)

I've wanted to use node-webgl backend instead, but this one on the other hand looks unmaintained ( mikeseven/node-webgl#64 ).

In the end, the cpu mode works, and when it comes to tests, it's good enough for me :) So I think it's not really gpu.js issue, feel free to close it if you wish :)

@robertleeplummerjr
Copy link
Member

robertleeplummerjr commented Apr 4, 2019

Ty for the update. We will continue to investigate this issue in headless-gl.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants