You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directmemory.apache.org by "Min Zhou (JIRA)" <ji...@apache.org> on 2012/09/29 08:56:07 UTC

[jira] [Created] (DIRECTMEMORY-101) JVM never exit even the main thread finished

Min Zhou created DIRECTMEMORY-101:
-------------------------------------

             Summary: JVM never exit even the main thread finished
                 Key: DIRECTMEMORY-101
                 URL: https://issues.apache.org/jira/browse/DIRECTMEMORY-101
             Project: Apache DirectMemory
          Issue Type: Bug
          Components: core
    Affects Versions: 0.2
            Reporter: Min Zhou


I wrote some microbenchmark code , which just simply put 10 millions of <key,value> in to directorymemory.  and found that JVM never exit even the main thread finished running.

{noformat}
public class Benchmark
{
    
    private static long ITER = 1000000000L;

    public static double testHeap()
    {
        CacheService<Long, String> cacheService = new DirectMemory<Long, String>()
                        .setNumberOfBuffers( 100 )
                        .setSize( 10000 )
                        .setInitialCapacity( 100000 )
                        .setConcurrencyLevel( 1 )
                        .setSerializer( new MessagePackSerializer() )
                        .newCacheService();
        
        final String str = "helloworld";

        // warm up
        for(long l = 0; l < ITER; l++) {
            cacheService.put(l, str);
        }
        cacheService.clear();
        long start = System.currentTimeMillis();
        for(long l = 0; l < ITER; l++) {
            cacheService.put(l, str);
        }
        return ((double)  ITER / (System.currentTimeMillis() - start )) * 1000;
    }
    

    public static void main( String[] args )
    {
        ITER = Long.parseLong( args[0] );
        System.gc();
        System.out.println("testHeap: ops=" + testHeap());
    }

}

{noformat}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Re: [jira] [Updated] (DIRECTMEMORY-101) JVM never exit even the main thread finished

Posted by "Raffaele P. Guidi" <ra...@gmail.com>.
thanks, I'll try to check it out ASAP

Ciao,
    R

On Sat, Sep 29, 2012 at 9:00 AM, Min Zhou (JIRA) <ji...@apache.org> wrote:

>
>      [
> https://issues.apache.org/jira/browse/DIRECTMEMORY-101?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel]
>
> Min Zhou updated DIRECTMEMORY-101:
> ----------------------------------
>
>     Attachment: DIRECTMEMORY-101.diff
>
> After jstack the process, I found that there was a non-daemon thread still
> running. The timer was released by CacheServiceImpl.java.
> Fixing this issue is quite easy, simply turn the code to  construct a
> daemon  timer.
>
> DIRECTMEMORY-101.diff is the patch for this issue.
>
> > JVM never exit even the main thread finished
> > --------------------------------------------
> >
> >                 Key: DIRECTMEMORY-101
> >                 URL:
> https://issues.apache.org/jira/browse/DIRECTMEMORY-101
> >             Project: Apache DirectMemory
> >          Issue Type: Bug
> >          Components: core
> >    Affects Versions: 0.2
> >            Reporter: Min Zhou
> >         Attachments: DIRECTMEMORY-101.diff
> >
> >
> > I wrote some microbenchmark code , which just simply put 10 millions of
> <key,value> in to directorymemory.  and found that JVM never exit even the
> main thread finished running.
> > {noformat}
> > public class Benchmark
> > {
> >
> >     private static long ITER = 1000000000L;
> >     public static double testHeap()
> >     {
> >         CacheService<Long, String> cacheService = new DirectMemory<Long,
> String>()
> >                         .setNumberOfBuffers( 100 )
> >                         .setSize( 10000 )
> >                         .setInitialCapacity( 100000 )
> >                         .setConcurrencyLevel( 1 )
> >                         .setSerializer( new MessagePackSerializer() )
> >                         .newCacheService();
> >
> >         final String str = "helloworld";
> >         // warm up
> >         for(long l = 0; l < ITER; l++) {
> >             cacheService.put(l, str);
> >         }
> >         cacheService.clear();
> >         long start = System.currentTimeMillis();
> >         for(long l = 0; l < ITER; l++) {
> >             cacheService.put(l, str);
> >         }
> >         return ((double)  ITER / (System.currentTimeMillis() - start ))
> * 1000;
> >     }
> >
> >     public static void main( String[] args )
> >     {
> >         ITER = Long.parseLong( args[0] );
> >         System.gc();
> >         System.out.println("testHeap: ops=" + testHeap());
> >     }
> > }
> > {noformat}
>
> --
> This message is automatically generated by JIRA.
> If you think it was sent incorrectly, please contact your JIRA
> administrators
> For more information on JIRA, see: http://www.atlassian.com/software/jira
>

[jira] [Closed] (DIRECTMEMORY-101) JVM never exit even the main thread finished

Posted by "Raffaele P. Guidi (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DIRECTMEMORY-101?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Raffaele P. Guidi closed DIRECTMEMORY-101.
------------------------------------------


ok this was easy :) thanks for submitting and solving it, Min
                
> JVM never exit even the main thread finished
> --------------------------------------------
>
>                 Key: DIRECTMEMORY-101
>                 URL: https://issues.apache.org/jira/browse/DIRECTMEMORY-101
>             Project: Apache DirectMemory
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 0.2
>            Reporter: Min Zhou
>            Assignee: Raffaele P. Guidi
>         Attachments: DIRECTMEMORY-101.diff
>
>
> I wrote some microbenchmark code , which just simply put 10 millions of <key,value> in to directorymemory.  and found that JVM never exit even the main thread finished running.
> {noformat}
> public class Benchmark
> {
>     
>     private static long ITER = 1000000000L;
>     public static double testHeap()
>     {
>         CacheService<Long, String> cacheService = new DirectMemory<Long, String>()
>                         .setNumberOfBuffers( 100 )
>                         .setSize( 10000 )
>                         .setInitialCapacity( 100000 )
>                         .setConcurrencyLevel( 1 )
>                         .setSerializer( new MessagePackSerializer() )
>                         .newCacheService();
>         
>         final String str = "helloworld";
>         // warm up
>         for(long l = 0; l < ITER; l++) {
>             cacheService.put(l, str);
>         }
>         cacheService.clear();
>         long start = System.currentTimeMillis();
>         for(long l = 0; l < ITER; l++) {
>             cacheService.put(l, str);
>         }
>         return ((double)  ITER / (System.currentTimeMillis() - start )) * 1000;
>     }
>     
>     public static void main( String[] args )
>     {
>         ITER = Long.parseLong( args[0] );
>         System.gc();
>         System.out.println("testHeap: ops=" + testHeap());
>     }
> }
> {noformat}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Resolved] (DIRECTMEMORY-101) JVM never exit even the main thread finished

Posted by "Raffaele P. Guidi (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DIRECTMEMORY-101?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Raffaele P. Guidi resolved DIRECTMEMORY-101.
--------------------------------------------

    Resolution: Fixed

done with r1393170
                
> JVM never exit even the main thread finished
> --------------------------------------------
>
>                 Key: DIRECTMEMORY-101
>                 URL: https://issues.apache.org/jira/browse/DIRECTMEMORY-101
>             Project: Apache DirectMemory
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 0.2
>            Reporter: Min Zhou
>            Assignee: Raffaele P. Guidi
>         Attachments: DIRECTMEMORY-101.diff
>
>
> I wrote some microbenchmark code , which just simply put 10 millions of <key,value> in to directorymemory.  and found that JVM never exit even the main thread finished running.
> {noformat}
> public class Benchmark
> {
>     
>     private static long ITER = 1000000000L;
>     public static double testHeap()
>     {
>         CacheService<Long, String> cacheService = new DirectMemory<Long, String>()
>                         .setNumberOfBuffers( 100 )
>                         .setSize( 10000 )
>                         .setInitialCapacity( 100000 )
>                         .setConcurrencyLevel( 1 )
>                         .setSerializer( new MessagePackSerializer() )
>                         .newCacheService();
>         
>         final String str = "helloworld";
>         // warm up
>         for(long l = 0; l < ITER; l++) {
>             cacheService.put(l, str);
>         }
>         cacheService.clear();
>         long start = System.currentTimeMillis();
>         for(long l = 0; l < ITER; l++) {
>             cacheService.put(l, str);
>         }
>         return ((double)  ITER / (System.currentTimeMillis() - start )) * 1000;
>     }
>     
>     public static void main( String[] args )
>     {
>         ITER = Long.parseLong( args[0] );
>         System.gc();
>         System.out.println("testHeap: ops=" + testHeap());
>     }
> }
> {noformat}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (DIRECTMEMORY-101) JVM never exit even the main thread finished

Posted by "Min Zhou (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DIRECTMEMORY-101?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Min Zhou updated DIRECTMEMORY-101:
----------------------------------

    Attachment: DIRECTMEMORY-101.diff

After jstack the process, I found that there was a non-daemon thread still running. The timer was released by CacheServiceImpl.java. 
Fixing this issue is quite easy, simply turn the code to  construct a daemon  timer.

DIRECTMEMORY-101.diff is the patch for this issue.
                
> JVM never exit even the main thread finished
> --------------------------------------------
>
>                 Key: DIRECTMEMORY-101
>                 URL: https://issues.apache.org/jira/browse/DIRECTMEMORY-101
>             Project: Apache DirectMemory
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 0.2
>            Reporter: Min Zhou
>         Attachments: DIRECTMEMORY-101.diff
>
>
> I wrote some microbenchmark code , which just simply put 10 millions of <key,value> in to directorymemory.  and found that JVM never exit even the main thread finished running.
> {noformat}
> public class Benchmark
> {
>     
>     private static long ITER = 1000000000L;
>     public static double testHeap()
>     {
>         CacheService<Long, String> cacheService = new DirectMemory<Long, String>()
>                         .setNumberOfBuffers( 100 )
>                         .setSize( 10000 )
>                         .setInitialCapacity( 100000 )
>                         .setConcurrencyLevel( 1 )
>                         .setSerializer( new MessagePackSerializer() )
>                         .newCacheService();
>         
>         final String str = "helloworld";
>         // warm up
>         for(long l = 0; l < ITER; l++) {
>             cacheService.put(l, str);
>         }
>         cacheService.clear();
>         long start = System.currentTimeMillis();
>         for(long l = 0; l < ITER; l++) {
>             cacheService.put(l, str);
>         }
>         return ((double)  ITER / (System.currentTimeMillis() - start )) * 1000;
>     }
>     
>     public static void main( String[] args )
>     {
>         ITER = Long.parseLong( args[0] );
>         System.gc();
>         System.out.println("testHeap: ops=" + testHeap());
>     }
> }
> {noformat}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (DIRECTMEMORY-101) JVM never exit even the main thread finished

Posted by "Hudson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIRECTMEMORY-101?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13468077#comment-13468077 ] 

Hudson commented on DIRECTMEMORY-101:
-------------------------------------

Integrated in directmemory-trunk #328 (See [https://builds.apache.org/job/directmemory-trunk/328/])
    fixes DIRECTMEMORY-101 (timer set as daemon to avoid keeping the jvm
running after exit) (Revision 1393170)

     Result = SUCCESS
raffaeleguidi : 
Files : 
* /directmemory/trunk/directmemory-cache/src/main/java/org/apache/directmemory/cache/CacheServiceImpl.java

                
> JVM never exit even the main thread finished
> --------------------------------------------
>
>                 Key: DIRECTMEMORY-101
>                 URL: https://issues.apache.org/jira/browse/DIRECTMEMORY-101
>             Project: Apache DirectMemory
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 0.2
>            Reporter: Min Zhou
>            Assignee: Raffaele P. Guidi
>         Attachments: DIRECTMEMORY-101.diff
>
>
> I wrote some microbenchmark code , which just simply put 10 millions of <key,value> in to directorymemory.  and found that JVM never exit even the main thread finished running.
> {noformat}
> public class Benchmark
> {
>     
>     private static long ITER = 1000000000L;
>     public static double testHeap()
>     {
>         CacheService<Long, String> cacheService = new DirectMemory<Long, String>()
>                         .setNumberOfBuffers( 100 )
>                         .setSize( 10000 )
>                         .setInitialCapacity( 100000 )
>                         .setConcurrencyLevel( 1 )
>                         .setSerializer( new MessagePackSerializer() )
>                         .newCacheService();
>         
>         final String str = "helloworld";
>         // warm up
>         for(long l = 0; l < ITER; l++) {
>             cacheService.put(l, str);
>         }
>         cacheService.clear();
>         long start = System.currentTimeMillis();
>         for(long l = 0; l < ITER; l++) {
>             cacheService.put(l, str);
>         }
>         return ((double)  ITER / (System.currentTimeMillis() - start )) * 1000;
>     }
>     
>     public static void main( String[] args )
>     {
>         ITER = Long.parseLong( args[0] );
>         System.gc();
>         System.out.println("testHeap: ops=" + testHeap());
>     }
> }
> {noformat}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Assigned] (DIRECTMEMORY-101) JVM never exit even the main thread finished

Posted by "Raffaele P. Guidi (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DIRECTMEMORY-101?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Raffaele P. Guidi reassigned DIRECTMEMORY-101:
----------------------------------------------

    Assignee: Raffaele P. Guidi
    
> JVM never exit even the main thread finished
> --------------------------------------------
>
>                 Key: DIRECTMEMORY-101
>                 URL: https://issues.apache.org/jira/browse/DIRECTMEMORY-101
>             Project: Apache DirectMemory
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 0.2
>            Reporter: Min Zhou
>            Assignee: Raffaele P. Guidi
>         Attachments: DIRECTMEMORY-101.diff
>
>
> I wrote some microbenchmark code , which just simply put 10 millions of <key,value> in to directorymemory.  and found that JVM never exit even the main thread finished running.
> {noformat}
> public class Benchmark
> {
>     
>     private static long ITER = 1000000000L;
>     public static double testHeap()
>     {
>         CacheService<Long, String> cacheService = new DirectMemory<Long, String>()
>                         .setNumberOfBuffers( 100 )
>                         .setSize( 10000 )
>                         .setInitialCapacity( 100000 )
>                         .setConcurrencyLevel( 1 )
>                         .setSerializer( new MessagePackSerializer() )
>                         .newCacheService();
>         
>         final String str = "helloworld";
>         // warm up
>         for(long l = 0; l < ITER; l++) {
>             cacheService.put(l, str);
>         }
>         cacheService.clear();
>         long start = System.currentTimeMillis();
>         for(long l = 0; l < ITER; l++) {
>             cacheService.put(l, str);
>         }
>         return ((double)  ITER / (System.currentTimeMillis() - start )) * 1000;
>     }
>     
>     public static void main( String[] args )
>     {
>         ITER = Long.parseLong( args[0] );
>         System.gc();
>         System.out.println("testHeap: ops=" + testHeap());
>     }
> }
> {noformat}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira