You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@harmony.apache.org by "Geir Magnusson Jr." <ge...@pobox.com> on 2006/10/17 01:29:49 UTC

[drlvm] Thread me tender, thread me true, never throw an OOM...

So, with
> public class Test implements Runnable {
>     static int i = 0;
>     public void run() {
>         try {
>             Thread.sleep(1);
>         } catch (Throwable e) { 
>             e.printStackTrace();
>         }
>     }
> 
>     Test() {
>         new Thread(this).start();
>     }
> 
>     public static void main(String args[]) {
>         for(;;) {
>           i++;
>           if (i % 1000 == 0) {
>                 System.out.println("Iteration: " + i);
>           }
>           new Test();
>         }
>     }
> }

How far do you get? I get to 340...  and then OOM.  Why are threads so 
heavy?

geir

---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org


Re: [drlvm] Thread me tender, thread me true, never throw an OOM...

Posted by "Geir Magnusson Jr." <ge...@pobox.com>.

Artem Aliev wrote:
> Gier,
> 
> I do some experiments on this issue.
> It is funny, but it is reproduced only by ubuntu user that logged to 
> console.
> It does not reproduce on SuSe at all.

This is related to my instinct that there's something weird about Ubuntu 
  and memory.  Remember the fork() ENOMOM issue that we found in 
classlib?  I could repeat it when Eclipse was running (separate process) 
and it went away when it wasn't. And someone else is struggling with 
under Ubuntu?

> 
> Following sequence is more funny : ))
> #ali@ubuntu> java Test
> fail ... on 370
> #ali@ubuntu> su - kna
> #kna@ubuntu> java Test
> passed with 4700000
> #kna@ubuntu> su - ali
> ali@ubuntu> java Test
> passed with 4700000
> 
> I'll try to solve  the mystery.
> It could be a problem with freeing memory from dead threads and with
> the linkage.
> Attached build fix introduce  -lpthread shared linkage. This allows
> specify thread stack size in our VM (1M by default). thread count int
> Test increase from 370 to 1000.

That number is still low.

I'm glad it's just on Ubuntu and not a general issue. I'll try it under 
Ubuntu 5.

geir
> 
> Thanks
> Artem
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> On 17 Oct 2006 16:14:58 +0700, Egor Pasko <eg...@gmail.com> wrote:
>> On the 0x205 day of Apache Harmony Geir Magnusson, Jr. wrote:
>> > So, with
>> > > public class Test implements Runnable {
>> > >     static int i = 0;
>> > >     public void run() {
>> > >         try {
>> > >             Thread.sleep(1);
>> > >         } catch (Throwable e) {             e.printStackTrace();
>> > >         }
>> > >     }
>> > >     Test() {
>> > >         new Thread(this).start();
>> > >     }
>> > >     public static void main(String args[]) {
>> > >         for(;;) {
>> > >           i++;
>> > >           if (i % 1000 == 0) {
>> > >                 System.out.println("Iteration: " + i);
>> > >           }
>> > >           new Test();
>> > >         }
>> > >     }
>> > > }
>> >
>> > How far do you get? I get to 340...  and then OOM.  Why are threads so
>> > heavy?
>>
>> 4435000 on SUSE9 with:
>> object_handles.cpp:270: ObjectHandlesNew* 
>> oh_add_new_handles(ObjectHandlesNew**): Assertion `n' failed
>>
>> Jrockit gave no more than 405000. Even more interesting...
>>
>> -- 
>> Egor Pasko, Intel Managed Runtime Division
>>
>>
>> ---------------------------------------------------------------------
>> Terms of use : http://incubator.apache.org/harmony/mailing.html
>> To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
>> For additional commands, e-mail: harmony-dev-help@incubator.apache.org
>>
>>
> 
> ------------------------------------------------------------------------
> 
> Index: build/make/components/vm/vmcore.xml
> ===================================================================
> --- build/make/components/vm/vmcore.xml	(revision 464417)
> +++ build/make/components/vm/vmcore.xml	(working copy)
> @@ -292,13 +292,6 @@
>  
>              <select os="lnx">
>                  <syslibset type="shared" libs="m,dl,stdc++,z,xml2,pthread,gcc_s,rt" /> 
> -                <linkerarg value="--export-dynamic" />
> -                <!--linkerarg value="-lz" />
> -                <linkerarg value="-lxml2" />
> -                <linkerarg value="-lm" />
> -                <linkerarg value="-ldl" />
> -                <linkerarg value="-lpthread" />
> -                <linkerarg value="-lstdc++" /-->
>              </select>
>          </linker>
>      </target>
> Index: build/make/components/vm/hythr.xml
> ===================================================================
> --- build/make/components/vm/hythr.xml	(revision 464417)
> +++ build/make/components/vm/hythr.xml	(working copy)
> @@ -95,11 +95,11 @@
>              </select>
>  
>              <select os="lnx">
> -                <syslibset libs="rt" />
> +                <syslibset libs="pthread,rt" />
>                  <linkerarg value="-Wl,-init" />
>                  <linkerarg value="-Wl,hythread_library_init" />
>                  <linkerarg value="-Wl,--version-script,${src}/thread/src/hythr.exp" />
> -            </select>
> +           </select>
>  
>              <select os="win">
>                  <syslibset libs="advapi32,ws2_32" />
> Index: build/make/targets/common_vm.xml
> ===================================================================
> --- build/make/targets/common_vm.xml	(revision 464417)
> +++ build/make/targets/common_vm.xml	(working copy)
> @@ -207,8 +207,8 @@
>                  <syslibset libs="advapi32,odbc32,userenv,ws2_32,mswsock" />
>              </select>
>              <select os="lnx" arch="ia32">
> -                <syslibset type="static" libs="z,pthread,xml2" />
> -                <syslibset type="shared" libs="m,dl,stdc++,rt" />
> +                <syslibset type="static" libs="z,xml2" />
> +                <syslibset type="shared" libs="m,dl,stdc++,rt,pthread" />
>              </select>
>              <select os="lnx" cxx="gcc" arch="ia32">
>                  <linkerarg value="-lgcc_s" />
> Index: build/make/targets/common_extra.xml
> ===================================================================
> --- build/make/targets/common_extra.xml	(revision 464417)
> +++ build/make/targets/common_extra.xml	(working copy)
> @@ -46,8 +46,8 @@
>                  <syslibset libs="advapi32,odbc32,userenv,ws2_32,mswsock" />
>              </select>
>              <select os="lnx">
> -                <syslibset type="static" libs="z,pthread,xml2" />
> -                <syslibset type="shared" libs="m,dl,stdc++" />
> +                <syslibset type="static" libs="z,xml2" />
> +                <syslibset type="shared" libs="m,dl,stdc++,pthread" />
>              </select>
>              <select os="lnx" cxx="gcc">
>                  <syslibset type="shared" libs="gcc_s" />
> 
> 
> ------------------------------------------------------------------------
> 
> ---------------------------------------------------------------------
> Terms of use : http://incubator.apache.org/harmony/mailing.html
> To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
> For additional commands, e-mail: harmony-dev-help@incubator.apache.org

---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org


Re: [drlvm] Thread me tender, thread me true, never throw an OOM...

Posted by Artem Aliev <ar...@gmail.com>.
Gier,

I do some experiments on this issue.
It is funny, but it is reproduced only by ubuntu user that logged to console.
It does not reproduce on SuSe at all.

Following sequence is more funny : ))
#ali@ubuntu> java Test
fail ... on 370
#ali@ubuntu> su - kna
#kna@ubuntu> java Test
passed with 4700000
#kna@ubuntu> su - ali
ali@ubuntu> java Test
passed with 4700000

I'll try to solve  the mystery.
It could be a problem with freeing memory from dead threads and with
the linkage.
Attached build fix introduce  -lpthread shared linkage. This allows
specify thread stack size in our VM (1M by default). thread count int
Test increase from 370 to 1000.

Thanks
Artem










On 17 Oct 2006 16:14:58 +0700, Egor Pasko <eg...@gmail.com> wrote:
> On the 0x205 day of Apache Harmony Geir Magnusson, Jr. wrote:
> > So, with
> > > public class Test implements Runnable {
> > >     static int i = 0;
> > >     public void run() {
> > >         try {
> > >             Thread.sleep(1);
> > >         } catch (Throwable e) {             e.printStackTrace();
> > >         }
> > >     }
> > >     Test() {
> > >         new Thread(this).start();
> > >     }
> > >     public static void main(String args[]) {
> > >         for(;;) {
> > >           i++;
> > >           if (i % 1000 == 0) {
> > >                 System.out.println("Iteration: " + i);
> > >           }
> > >           new Test();
> > >         }
> > >     }
> > > }
> >
> > How far do you get? I get to 340...  and then OOM.  Why are threads so
> > heavy?
>
> 4435000 on SUSE9 with:
> object_handles.cpp:270: ObjectHandlesNew* oh_add_new_handles(ObjectHandlesNew**): Assertion `n' failed
>
> Jrockit gave no more than 405000. Even more interesting...
>
> --
> Egor Pasko, Intel Managed Runtime Division
>
>
> ---------------------------------------------------------------------
> Terms of use : http://incubator.apache.org/harmony/mailing.html
> To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
> For additional commands, e-mail: harmony-dev-help@incubator.apache.org
>
>

Re: [drlvm] Thread me tender, thread me true, never throw an OOM...

Posted by "Geir Magnusson Jr." <ge...@pobox.com>.
No way - I shouldn't have to any extra stuff to create more than 340 
threads before DRLVM falls over.

I'm convinced there's something odd about Ubuntu...

geir


Artem Aliev wrote:
> "-Dvm.finalize=off" also help :)
> 
> 
> 
> On 10/17/06, Weldon Washburn <we...@gmail.com> wrote:
>> Geir,
>> I am running Test.java on windows with an svn revision from late last 
>> week.
>> Right now, it is at "Iteration: 1400000" and still going.  Because of 
>> MMTk
>> porting, GCV4.0 is configured in.  Perhaps you can try with GCV4.0 to 
>> narrow
>> down where the bug is?
>>
>>
>> On 17 Oct 2006 16:14:58 +0700, Egor Pasko <eg...@gmail.com> wrote:
>> >
>> > On the 0x205 day of Apache Harmony Geir Magnusson, Jr. wrote:
>> > > So, with
>> > > > public class Test implements Runnable {
>> > > >     static int i = 0;
>> > > >     public void run() {
>> > > >         try {
>> > > >             Thread.sleep(1);
>> > > >         } catch (Throwable e) {             e.printStackTrace();
>> > > >         }
>> > > >     }
>> > > >     Test() {
>> > > >         new Thread(this).start();
>> > > >     }
>> > > >     public static void main(String args[]) {
>> > > >         for(;;) {
>> > > >           i++;
>> > > >           if (i % 1000 == 0) {
>> > > >                 System.out.println("Iteration: " + i);
>> > > >           }
>> > > >           new Test();
>> > > >         }
>> > > >     }
>> > > > }
>> > >
>> > > How far do you get? I get to 340...  and then OOM.  Why are 
>> threads so
>> > > heavy?
>> >
>> > 4435000 on SUSE9 with:
>> > object_handles.cpp:270: ObjectHandlesNew*
>> > oh_add_new_handles(ObjectHandlesNew**): Assertion `n' failed
>> >
>> > Jrockit gave no more than 405000. Even more interesting...
>> >
>> > --
>> > Egor Pasko, Intel Managed Runtime Division
>> >
>> >
>> > ---------------------------------------------------------------------
>> > Terms of use : http://incubator.apache.org/harmony/mailing.html
>> > To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
>> > For additional commands, e-mail: harmony-dev-help@incubator.apache.org
>> >
>> >
>>
>>
>> -- 
>> Weldon Washburn
>> Intel Middleware Products Division
>>
>>
> 
> ---------------------------------------------------------------------
> Terms of use : http://incubator.apache.org/harmony/mailing.html
> To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
> For additional commands, e-mail: harmony-dev-help@incubator.apache.org
> 

---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org


Re: [drlvm] Thread me tender, thread me true, never throw an OOM...

Posted by Artem Aliev <ar...@gmail.com>.
"-Dvm.finalize=off" also help :)



On 10/17/06, Weldon Washburn <we...@gmail.com> wrote:
> Geir,
> I am running Test.java on windows with an svn revision from late last week.
> Right now, it is at "Iteration: 1400000" and still going.  Because of MMTk
> porting, GCV4.0 is configured in.  Perhaps you can try with GCV4.0 to narrow
> down where the bug is?
>
>
> On 17 Oct 2006 16:14:58 +0700, Egor Pasko <eg...@gmail.com> wrote:
> >
> > On the 0x205 day of Apache Harmony Geir Magnusson, Jr. wrote:
> > > So, with
> > > > public class Test implements Runnable {
> > > >     static int i = 0;
> > > >     public void run() {
> > > >         try {
> > > >             Thread.sleep(1);
> > > >         } catch (Throwable e) {             e.printStackTrace();
> > > >         }
> > > >     }
> > > >     Test() {
> > > >         new Thread(this).start();
> > > >     }
> > > >     public static void main(String args[]) {
> > > >         for(;;) {
> > > >           i++;
> > > >           if (i % 1000 == 0) {
> > > >                 System.out.println("Iteration: " + i);
> > > >           }
> > > >           new Test();
> > > >         }
> > > >     }
> > > > }
> > >
> > > How far do you get? I get to 340...  and then OOM.  Why are threads so
> > > heavy?
> >
> > 4435000 on SUSE9 with:
> > object_handles.cpp:270: ObjectHandlesNew*
> > oh_add_new_handles(ObjectHandlesNew**): Assertion `n' failed
> >
> > Jrockit gave no more than 405000. Even more interesting...
> >
> > --
> > Egor Pasko, Intel Managed Runtime Division
> >
> >
> > ---------------------------------------------------------------------
> > Terms of use : http://incubator.apache.org/harmony/mailing.html
> > To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
> > For additional commands, e-mail: harmony-dev-help@incubator.apache.org
> >
> >
>
>
> --
> Weldon Washburn
> Intel Middleware Products Division
>
>

---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org


Re: [drlvm] Thread me tender, thread me true, never throw an OOM...

Posted by Ivan Volosyuk <iv...@gmail.com>.
The same for GCv4.1 (on Windows). More then 1500000 and counting.
--
Ivan

On 10/17/06, Weldon Washburn <we...@gmail.com> wrote:
> Geir,
> I am running Test.java on windows with an svn revision from late last week.
> Right now, it is at "Iteration: 1400000" and still going.  Because of MMTk
> porting, GCV4.0 is configured in.  Perhaps you can try with GCV4.0 to narrow
> down where the bug is?
>
>
> On 17 Oct 2006 16:14:58 +0700, Egor Pasko <eg...@gmail.com> wrote:
> >
> > On the 0x205 day of Apache Harmony Geir Magnusson, Jr. wrote:
> > > So, with
> > > > public class Test implements Runnable {
> > > >     static int i = 0;
> > > >     public void run() {
> > > >         try {
> > > >             Thread.sleep(1);
> > > >         } catch (Throwable e) {             e.printStackTrace();
> > > >         }
> > > >     }
> > > >     Test() {
> > > >         new Thread(this).start();
> > > >     }
> > > >     public static void main(String args[]) {
> > > >         for(;;) {
> > > >           i++;
> > > >           if (i % 1000 == 0) {
> > > >                 System.out.println("Iteration: " + i);
> > > >           }
> > > >           new Test();
> > > >         }
> > > >     }
> > > > }
> > >
> > > How far do you get? I get to 340...  and then OOM.  Why are threads so
> > > heavy?
> >
> > 4435000 on SUSE9 with:
> > object_handles.cpp:270: ObjectHandlesNew*
> > oh_add_new_handles(ObjectHandlesNew**): Assertion `n' failed
> >
> > Jrockit gave no more than 405000. Even more interesting...
> >
> > --
> > Egor Pasko, Intel Managed Runtime Division

---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org


Re: [drlvm] Thread me tender, thread me true, never throw an OOM...

Posted by Weldon Washburn <we...@gmail.com>.
Geir,
I am running Test.java on windows with an svn revision from late last week.
Right now, it is at "Iteration: 1400000" and still going.  Because of MMTk
porting, GCV4.0 is configured in.  Perhaps you can try with GCV4.0 to narrow
down where the bug is?


On 17 Oct 2006 16:14:58 +0700, Egor Pasko <eg...@gmail.com> wrote:
>
> On the 0x205 day of Apache Harmony Geir Magnusson, Jr. wrote:
> > So, with
> > > public class Test implements Runnable {
> > >     static int i = 0;
> > >     public void run() {
> > >         try {
> > >             Thread.sleep(1);
> > >         } catch (Throwable e) {             e.printStackTrace();
> > >         }
> > >     }
> > >     Test() {
> > >         new Thread(this).start();
> > >     }
> > >     public static void main(String args[]) {
> > >         for(;;) {
> > >           i++;
> > >           if (i % 1000 == 0) {
> > >                 System.out.println("Iteration: " + i);
> > >           }
> > >           new Test();
> > >         }
> > >     }
> > > }
> >
> > How far do you get? I get to 340...  and then OOM.  Why are threads so
> > heavy?
>
> 4435000 on SUSE9 with:
> object_handles.cpp:270: ObjectHandlesNew*
> oh_add_new_handles(ObjectHandlesNew**): Assertion `n' failed
>
> Jrockit gave no more than 405000. Even more interesting...
>
> --
> Egor Pasko, Intel Managed Runtime Division
>
>
> ---------------------------------------------------------------------
> Terms of use : http://incubator.apache.org/harmony/mailing.html
> To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
> For additional commands, e-mail: harmony-dev-help@incubator.apache.org
>
>


-- 
Weldon Washburn
Intel Middleware Products Division

Re: [drlvm] Thread me tender, thread me true, never throw an OOM...

Posted by Egor Pasko <eg...@gmail.com>.
On the 0x205 day of Apache Harmony Geir Magnusson, Jr. wrote:
> So, with
> > public class Test implements Runnable {
> >     static int i = 0;
> >     public void run() {
> >         try {
> >             Thread.sleep(1);
> >         } catch (Throwable e) {             e.printStackTrace();
> >         }
> >     }
> >     Test() {
> >         new Thread(this).start();
> >     }
> >     public static void main(String args[]) {
> >         for(;;) {
> >           i++;
> >           if (i % 1000 == 0) {
> >                 System.out.println("Iteration: " + i);
> >           }
> >           new Test();
> >         }
> >     }
> > }
> 
> How far do you get? I get to 340...  and then OOM.  Why are threads so
> heavy?

4435000 on SUSE9 with:
object_handles.cpp:270: ObjectHandlesNew* oh_add_new_handles(ObjectHandlesNew**): Assertion `n' failed

Jrockit gave no more than 405000. Even more interesting...

-- 
Egor Pasko, Intel Managed Runtime Division


---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org