Closed
Issue #113 · created by Harshad RJ ·


Clear temporary folder / data upon exit

  • Use a better name for temporary folder. It is currently hard-coded to /tmp/data. We should be using a combination of 'package name', 'process-id' and a unique random number to create the temporary folder.

  • Upon exit (in node environment) we need to delete the temporary folder.


2 participants
  • 1419208586 beethoven 512 Harshad RJ @hrjet9

    mentioned in issue #101

    Edit in fullscreen
    Comments are parsed with GitLab Flavored Markdown
    Attach images (JPG, PNG, GIF) by dragging & dropping or selecting them.
  • No avatar
    Анатолий Русских @Titan ·
    1. Should I solve this issue (from javascript code)?
    2. is temp folder created by java (i.e. automatic) or should javascript also create temp folder at start?
    Edit in fullscreen
    Comments are parsed with GitLab Flavored Markdown
    Attach images (JPG, PNG, GIF) by dragging & dropping or selecting them.
  • 1419208586 beethoven 512
    Harshad RJ @hrjet9 ·

    @Titan Sure, assigning to you.

    There is a JavaPoly constructor option called storageDir which defines the directory where temporary data is to be stored. This directory is created by javascript in the jvmManagers found in src/jvmManager/*.

    So, you just need to initialize the default value of storageDir to a unique value, and remove the storageDir in the exit handler for node. For browser environment, handling exit is not possible / essential.

    Edit in fullscreen
    Comments are parsed with GitLab Flavored Markdown
    Attach images (JPG, PNG, GIF) by dragging & dropping or selecting them.
  • 1419208586 beethoven 512 Harshad RJ @hrjet9

    Reassigned to @Titan

    Edit in fullscreen
    Comments are parsed with GitLab Flavored Markdown
    Attach images (JPG, PNG, GIF) by dragging & dropping or selecting them.
  • 1419208586 beethoven 512
    Harshad RJ @hrjet9

    @Titan I edited my comment for clarity. Please read it again.

    Edit in fullscreen
    Comments are parsed with GitLab Flavored Markdown
    Attach images (JPG, PNG, GIF) by dragging & dropping or selecting them.
  • No avatar
    Анатолий Русских @Titan

    Ok. I understand you, later will solve it.

    Edit in fullscreen
    Comments are parsed with GitLab Flavored Markdown
    Attach images (JPG, PNG, GIF) by dragging & dropping or selecting them.
  • No avatar
    Анатолий Русских @Titan ·

    Something strange happening, maybe only on my PC.

    $ grunt build
    $ ./node_modules/mocha/bin/mocha test/TestJavaPolyNodeSystem.js
    

    I was working on issue #113 in my branch http://git.javadeploy.net/Titan/JavaPoly/commits/bug-%23113 and then try to use tests but they "hang". After some iteration I tried to launch tests on latest master branch, but it was same.

    titan@titan-home-pc> ./node_modules/mocha/bin/mocha test/TestJavaPolyNodeSystem.js                                     ~/1/JavaPoly
      javapoly test
    Java Main started
    
    after bridge Active count:8
        1) add jar
    Compiling: [-d, /tmp/data, /tmp/data/com/javapoly/test/Main3.java]
    titan@titan-home-pc>    
    

    Now I figure out that after this http://git.javadeploy.net/Titan/JavaPoly/commit/97d3190f3ffcc1575c657ed9bc495ec9b20222ec commit tests fail

    Edit in fullscreen
    Comments are parsed with GitLab Flavored Markdown
    Attach images (JPG, PNG, GIF) by dragging & dropping or selecting them.
  • No avatar
    Анатолий Русских @Titan

    i.e. this tests fail

    $ ./node_modules/mocha/bin/mocha test/TestJavaPolyNodeDoppio.js
    or
    $ ./node_modules/mocha/bin/mocha test/TestJavaPolyNodeSystem.js
    
    Edit in fullscreen
    Comments are parsed with GitLab Flavored Markdown
    Attach images (JPG, PNG, GIF) by dragging & dropping or selecting them.
  • No avatar
    Анатолий Русских @Titan

    Changes with error are in in this file src/dispatcher/CommonDispatcher.js

    Edit in fullscreen
    Comments are parsed with GitLab Flavored Markdown
    Attach images (JPG, PNG, GIF) by dragging & dropping or selecting them.
  • No avatar
    Анатолий Русских @Titan

    In debug:

    this.doppioManager.then(dm => dm.dynamicMountJava(data.src).then((msg) => {
    +          if (msg === "OK") {
    +            callback({success:true, returnValue: 'Add Class success'});
    +          } else {
    +            callback({success:false, returnValue: 'Add Class fail'});
    +          }
    

    msg = "Add Jar success"

    Edit in fullscreen
    Comments are parsed with GitLab Flavored Markdown
    Attach images (JPG, PNG, GIF) by dragging & dropping or selecting them.
  • 1419208586 beethoven 512
    Harshad RJ @hrjet9

    Sorry, my bad. I didn't test before pushing. I am working on it.

    Edit in fullscreen
    Comments are parsed with GitLab Flavored Markdown
    Attach images (JPG, PNG, GIF) by dragging & dropping or selecting them.
  • No avatar
    Анатолий Русских @Titan

    NP, my code working, do final tests.

    Edit in fullscreen
    Comments are parsed with GitLab Flavored Markdown
    Attach images (JPG, PNG, GIF) by dragging & dropping or selecting them.
  • No avatar
    Анатолий Русских @Titan

    Some my thoughts not related to this issue. In general current Node (i.e. v5 and v6) has good support es 2015, to use it, we just need to add "use strict"; into our project files, after that we don't need any processors (babel) at all...

    Edit in fullscreen
    Comments are parsed with GitLab Flavored Markdown
    Attach images (JPG, PNG, GIF) by dragging & dropping or selecting them.
  • 1419208586 beethoven 512
    Harshad RJ @hrjet9

    I have pushed a fix for the hanging problem. Let me know if it doesn't work.

    @Titan please create separate issue for "use strict". Note that we need to support browsers as well with a baseline of ES5.

    Edit in fullscreen
    Comments are parsed with GitLab Flavored Markdown
    Attach images (JPG, PNG, GIF) by dragging & dropping or selecting them.
  • No avatar
    Анатолий Русских @Titan

    My code to solve issue#113 work on my pc, please review it. http://git.javadeploy.net/Titan/JavaPoly/commits/bug-%23113

    Edit in fullscreen
    Comments are parsed with GitLab Flavored Markdown
    Attach images (JPG, PNG, GIF) by dragging & dropping or selecting them.
  • No avatar
    Анатолий Русских @Titan

    I'm testing:

    also I have this bug:

    titan@titan-home-pc> ./node_modules/mocha/bin/mocha test/TestJavaPolyNodeSystem.js                            ~/nodejsproj/JavaPoly
    
    Temp directory /tmp/javapoly-5393 was created.
    
    
      javapoly test
    Java Main started
    
    after bridge Active count:8
        ✓ add jar (141ms)
    Compiling: [-d, /tmp/javapoly-5393, /tmp/javapoly-5393/com/javapoly/test/Main3.java]
        ✓ compile java source (242ms)
        ✓ should handle exceptions correctly
        Proxy access
          java.lang.Integer
            ✓ toHexString
            ✓ reverse
            ✓ compare
            ✓ parseInt
          java.lang.Double
            ✓ toHexString
          classes/Main.class
            ✓ static test()
          jars/javapoly-utils.jar
            1) jar static test()
        Exception Tests
          Exception check
            ✓ should handle exceptions correctly
            ✓ should handle arithmetic exceptions correctly
        Reference Tests
          hold and release weak references
    Released obj
            ✓ should release references (3249ms)
        Reflection Tests
          Reflection
            ✓ should reflect js object into java
            ✓ should reflect js object from java
        Eval Tests
          Eval
            ✓ should pass all tests from EvalTest.java
    
    
      15 passing (2m)
      1 failing
    
      1) javapoly test Proxy access jars/javapoly-utils.jar jar static test():
         Error: timeout of 100000ms exceeded. Ensure the done() callback is being called in this test.
    
    
    
    
    Temp directory /tmp/javapoly-5393 successfully deleted.
    

    i.e. one test always fail, on NodeSystem test and NodeDoppio too. with timeout error.

    Edit in fullscreen
    Comments are parsed with GitLab Flavored Markdown
    Attach images (JPG, PNG, GIF) by dragging & dropping or selecting them.
  • 1419208586 beethoven 512
    Harshad RJ @hrjet9

    @Titan For changes related to this bug, please make a Merge request; I have some comments.

    I am not seeing any error on current master. All tests pass. If you are seeing the failure on master branch, please create a separate issue.

    Edit in fullscreen
    Comments are parsed with GitLab Flavored Markdown
    Attach images (JPG, PNG, GIF) by dragging & dropping or selecting them.
  • No avatar Анатолий Русских @Titan

    mentioned in merge request !26

    Edit in fullscreen
    Comments are parsed with GitLab Flavored Markdown
    Attach images (JPG, PNG, GIF) by dragging & dropping or selecting them.
  • No avatar
    Анатолий Русских @Titan ·

    Please review my merge request.

    let directoryPath = path.join(os.tmpdir(), 'javapoly-' + process.pid.toString()); I "hardcoded" package name, because it simplier at current moment, and do not create inner directory (i.e. path.join(os.tmpdir(), 'javapoly', process.pid.toString());) with same reason.

    Edit in fullscreen
    Comments are parsed with GitLab Flavored Markdown
    Attach images (JPG, PNG, GIF) by dragging & dropping or selecting them.
  • No avatar Анатолий Русских @Titan
    Edit in fullscreen
    Comments are parsed with GitLab Flavored Markdown
    Attach images (JPG, PNG, GIF) by dragging & dropping or selecting them.
  • 1419208586 beethoven 512 Harshad RJ @hrjet9
    Edit in fullscreen
    Comments are parsed with GitLab Flavored Markdown
    Attach images (JPG, PNG, GIF) by dragging & dropping or selecting them.
  • 1419208586 beethoven 512 Harshad RJ @hrjet9

    Status changed to closed

    Edit in fullscreen
    Comments are parsed with GitLab Flavored Markdown
    Attach images (JPG, PNG, GIF) by dragging & dropping or selecting them.
jimsproch/JavaPoly#113

Milestone: none


Votes
0 up
0 down

Labels