Error occurred during initialization of vm cannot create vm thread out of system resources

I try to create a JNIEnv in the hhvm extension but failed to create the VM with the error: Error occurred during initialization of VM Cannot create VM thread. Out of system resources. in a openjdk ...

@Helium3

I try to create a JNIEnv in the hhvm extension
but failed to create the VM with the error:

Error occurred during initialization of VM
Cannot create VM thread. Out of system resources.

in a openjdk 1.6 environment

It’s JNI_CreateJavaVM who fails
Could anybody help?

@danslo

Out of system resources. seems pretty clear, what is the free memory at that time?

@Helium3

Thanks for help. But the free memory is about 4GB at that time, free + cache is more than 20GB

And I do another test today.
I fork a new process in an extension

1. I call JNI interface to create JVM (fail with the same error)
2. I call execvp to a binary which call a JNI interface to create JVM (succeed)

So I’m very confused, as I linked same libjvm.so in 1 & 2
And I’ve checked ulimit, env, jvm args, all seems normal to me
Is there something I missed?

@danslo

It could have to do with JEMalloc, however I know too little about JNI (and hhvm for that matter) to back that up.

Sorry :/

@Helium3

Thank you for showing a way, I’ll dig deeper.

@scannell

Are you sure this is the right forum? We don’t have anything to do with Java or the JVM. Are you writing an HHVM extension that tries to create the JVM inside our process? If so, why?

@Helium3

Yes, I’m writing an HHVM extension to transform the php extension we used to use. The php extension call functions in libhdfs.so which will create a JVM.
So any advice on how to implement similar function?

@scannell

I’m unfamiliar with JNI but would personally not recommend hosting the JVM inside the HHVM process directly.

@Helium3

Is there any known issue or guess on how JVM and HHVM would interfere with each other?
Actually I fork a new process to create JVM so maybe the JEMalloc could be a problem.

@scannell

I’m unfamiliar with how the JVM allocates memory or compatibility with jemalloc but I’m guessing two VMs in the same process who both normally assume that they own the memory space and optimize for that is going to be less than ideal for performance even if it does functionally work.

@Helium3

Thanks, I will give it a try and give a feed back in a few days.

@scannell

Thanks. Closing this as it’s not really an HHVM issue. Let us know how it goes though. Thanks!

@Helium3

Hi,I track the jdk source and find something wrong at pthread_create:

int ret = pthread_create(&tid, &attr, (void* (*)(void*)) java_start, thread);

In hhvm, ret = 22, which is EINVAL
According to pthread doc, it should be attr who is doing evil.
As I run both piece of code in C and HHVM extension, the attr are the same. So it’s really confusing.

It could be the guard size problem. But it’s really a small size. (4096)
And the ulimit -s is 1MB

Anyway, I try to set attr to NULL and it works!!
So does hhvm link something different than normal pthread lib?

And JEMalloc doesn’t seem to be a problem as I use it in both C and HHVM extension

@scannell

We don’t do anything special regarding pthreads or pthread libraries that I know about. I’d ask around in the JDK community to see if they know anything about it.

@Helium3

That’ll be great help. Thank you very much.

@Helium3

Hi, the problem has not much to do with JDK. The real problem is pthread_create.
If we set stack size = 1MB in pthread_attr_t as the parameter to pthread_create, it will cause a segmentation fault
and stack size = 2MB works fine.

I believe HHVM will set a minimum 8MB stack size of each thread it create, but I don’t think there is a reason why setting a smaller stack size fails. I’ve asked around, but got no answer. So anyone one could help me out?

To be specific, 1MB+48KB is the critical value on my machine, stack size >= 1MB+48KB will work
Does this number mean anything?

@scannell

Dupe of #1015 (which is newer but has more helpful information.)

Unable to create new native threads resolution

In one of our new machines, we are trying to start our servers. For 4 Servers, the system was working properly, but with 8 Servers it was throwing below exception.

[gsc][3/20922] Caused by: java.lang.OutOfMemoryError: unable to create new native thread
2012-09-19 20:06:24,217 GSA WARNING [com.gigaspaces.grid.gsa] — [gsc][3/20922]: Reported Error [Restart Regex [.*java.lang.OutOfMemoryError.*] matching [Caused by: java.lang.OutOfMemoryError: unable to create new native thread]], restarting
[gsc][1/] /<path>//bin/gs.sh: line 92: 21421 Aborted (core dumped) «$JAVACMD» ${JAVA_OPTIONS} -DagentId=${AGENT_ID} -DgsaServiceID=${GSA_SERVICE_ID} $bootclasspath $script_classpath ${RMI_OPTIONS} $libpath ${LOOKUP_GROUPS_PROP} ${LOOKUP_LOCATORS_PROP} -Dcom.gs.logging.debug=false ${GS_LOGGING_CONFIG_FILE_PROP} $NETWORK $DEBUG $launchTarget $command_line

#
# There is insufficient memory for the Java Runtime Environment to continue.
# Cannot create GC thread. Out of system resources.
# Possible reasons:
# The system is out of physical RAM or swap space
# In 32 bit mode, the process size limit was hit
# Possible solutions:
# Reduce memory load on the system
# Increase physical memory or swap space
# Check if swap backing store is full
# Use 64 bit Java on a 64 bit OS
# Decrease Java heap size (-Xmx/-Xms)
# Decrease number of Java threads
# Decrease Java thread stack sizes (-Xss)
# Set larger code cache with -XX:ReservedCodeCacheSize=
# This output file may be truncated or incomplete.
#
# Out of Memory Error (gcTaskThread.cpp:46), pid=26777, tid=140045563242240
#
# JRE version: 7.0_04-b20
# Java VM: Java HotSpot(TM) 64-Bit Server VM (23.0-b21 mixed mode linux-amd64 compressed oops)
I cannot even call java -version.
$ /usr/java/jre1.7.0_04/bin/java -version
Picked up JAVA_TOOL_OPTIONS: -Djava.security.egd=file:/dev/../dev/urandom
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Cannot create GC thread. Out of system resources.
# An error report file with more information is saved as:
# <path>/hs_err_pid29487.log
$ /usr/java/jre1.7.0_04/bin/java -version
Picked up JAVA_TOOL_OPTIONS: -Djava.security.egd=file:/dev/../dev/urandom
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Cannot create GC thread. Out of system resources.
# An error report file with more information is saved as:
# <Path>/hs_err_pid29491.log

Solution:
Change the ulimit parameters as below:

In /etc/security/limits.conf add the following to the end of the file:

* soft nproc 15349
* hard nproc 16384
* soft nofile 32768
* hard nofile 65536
* soft core 2097152
* hard core unlimited

We had done that previously, however one more thing needed to be changed for the number of user processes.

In /etc/security/limits.d/90-nproc.conf change the soft nproc from 1024 to 15349:
*          soft    nproc     15349

This change is not applied until the user logs out and then logs back in.

$ ulimit -u
15349

Now try to run the program, there will be no out of memory exceptions.

Popular posts from this blog

Steps to Analyze AWR Report in Oracle

Image

Steps to Analyze AWR Report in Oracle AWR —   Automatic   workload repository is a collection of persistent   system performance   statistics   owned by SYS. It resides in SYSAUX   tablespace . By default snapshot are generated once every 60 min and maintained for 7 days . Each snapshot has a unique ID know as «snap_id». Snapshot detail can be found in » dba_hist_snapshot » view.   If we have Database performance issue and not the Database machine, then AWR Report is the place to look at. AWR is not used for real-time performance monitoring like the v$ tables. It is used for historical analysis of performance. AWR complements, but doesnot replace real-time monitoring. Once AWR Report is generated in Oracle, the next task is to analyze it. By going through the AWR Report we can easily solve issues like slow database, high wait events, slow query and many more issues. Even though the report is lengthy, Analyzing or Reading relevant part of AWR Report can

Examples on Date and Time in LoadRunner

Following are some examples in Datetime Format: Datetime Format Codes The following format codes are supported for lr_save_datetime. Code Description %a day of week, using locale’s abbreviated weekday names %A day of week, using locale’s full weekday names %b month, using locale’s abbreviated month names %B month, using locale’s full month names %c date and time as %x %X %d day of month (01-31) %H hour (00-23) %I hour (00-12) %j number of day in year (001-366) %m month number (01-12) %M minute (00-59) %p locale’s equivalent of AM or PM, whichever is appropriate %S seconds (00-59) %U week number of year (01-52), Sunday is the first day of the week. Week number 01 is the first week with four or more January days in it. %w day of week

Verifications and Error Handling in LoadRunner *Web_reg_find and Web_reg_save_param*

Verification’s and Error Handling Verification points must be inserted into the scripts to verify the application being tested with the load. Verification function that are used in our application are:  Web_reg_find, web_reg_save_param These verification should be outside towards the end of the transaction. Mandatory verification points: ■          Login – whenever there is a login, verification points must be added to verify that the user logged in correctly. ■          Update Transactions – transactions that update the database must be verified that they are successful. ■          Each page should be verified using Web_reg_find function Using Web _ reg_find for verifications. Example: web_reg_find(«Text= Main Package»,»SaveCount=Verify_Count1″,LAST); Verification: if (strcmp(lr_eval_string(«{Verify_Count1}»),»0″)==0) { lr_end_transaction(«AddMainPackage», LR_FAIL);  lr_error_message(&q

Minecraft: Ошибка при инициализации ВМ (2 исправления) (02.09.23)

Ошибка при инициализации vm minecraft

Minecraft позволяет игрокам делать много разных вещей, одна из основных из которых заключается в том, что игра позволяет создавать практически все, что вы хотите. Однако есть также возможность создавать свои собственные серверы и делать много других вещей в игре, которые могут сделать ваш опыт намного более увлекательным и интересным, чем он есть. Однако игрокам иногда приходится перепрыгивать через несколько куч, чтобы получить доступ к этим перкам, и время от времени они могут даже сталкиваться с проблемой. Сегодня мы собираемся обсудить одну из этих проблем.

Minecraft: ошибка при инициализации виртуальной машины

Одной из наиболее распространенных ошибок, возникающих при попытке игроков запустить Minecraft или настроить сервер, является «Ошибка при инициализации виртуальной машины Minecraft». На самом деле это одна из самых распространенных проблем, с которыми сталкиваются игроки Minecraft, особенно те, кто впервые пробует игру на своем ПК. Однако это не повторяющаяся проблема, которая постоянно возникает и может быть решена с относительной легкостью. Просто попробуйте любое из приведенных ниже решений, и вы сможете избавиться от этой проблемы как можно скорее.

Популярные уроки Minecraft

  • Руководство для начинающих Minecraft — Как играть в Minecraft (Udemy)
  • Minecraft 101: научиться играть, создавать, строить и т. д. Save the Day (Udemy)
  • Создание мода Minecraft: модификация Minecraft для начинающих (Udemy)
  • Разработка подключаемых модулей Minecraft (Java) (Udemy)
  • Переустановите Java
  • Первое решение этой проблемы — одно из самых простых и, возможно, наиболее эффективное. Все, что вам нужно сделать, это полностью удалить Java с вашего устройства, а затем переустановить его. Единственная разница в том, что на этот раз вам нужно установить правильную версию для вашего компьютера. Вам нужно будет выяснить, какую версию вам нужно скачать. Например, вам нужно будет выбрать между 32-разрядной версией Java и 64-разрядной версией Java в зависимости от вашей версии Windows.

    Даже когда дело доходит до Windows 10, есть два основных варианта на выбор. Один из них — 32-битный вариант, а другой — 64-битный вариант. Просто убедитесь, что вы устанавливаете вариант java, соответствующий установленной вами версии Windows. Как только вы это сделаете, у вас больше не должно возникнуть этой проблемы. Обычно не имеет значения, какой у вас вариант, главное, чтобы он был правильным, поскольку между их возможностями производительности нет большой разницы. Однако большинство людей по-прежнему рекомендуют 64-битные программы вместо 32-битных аналогов по уважительной причине.

  • Выделить больше (или меньше) RAM
  • Правильный объем ОЗУ абсолютно необходим независимо от игры, в которую вы играете, и выделение слишком маленького объема не позволит вам играть в игру должным образом. Если у вас уже установлена ​​нужная версия Java, почти наверняка проблема заключается в объеме оперативной памяти, выделенной вами для Minecraft. К счастью, это еще одно простое в реализации решение, которое можно выполнить, просто выполнив действия, которые мы дали ниже.

    Первое, что вам нужно сделать, это открыть средство запуска Minecraft (версия для Java) и перейти на вкладку установки, которая находится в верхней части экрана. Теперь найдите желаемую версию Minecraft, настройки которой вы хотите изменить, и наведите на нее курсор. После этого вам нужно будет нажать на значок с тремя точками. Теперь выберите вариант с надписью «Изменить» из немногих, которые появятся, и вы сможете выбрать другой вариант с надписью «Дополнительные параметры», который должен находиться в нижнем левом углу экрана. После того, как вы нажмете на это, должно появиться поле аргументов JVM, к которому вы можете получить доступ и отредактировать. Получите доступ к этому полю и измените текущий –Xmx1G, который, вероятно, назначен на –Xmx # G. Знак # обозначает любой объем ОЗУ, который вы хотите выделить для игры.

    Однако убедитесь, что вы не переусердствуете при выполнении этих шагов, и выделите для игры больше ОЗУ, чем у вас есть. Выделение большего количества оперативной памяти, чем у вас есть, — еще одна распространенная причина столкнуться с этой проблемой, и вы должны убедиться, что вы выделяете только ту сумму, которую ваш компьютер может безопасно обрабатывать. В противном случае вы обязательно столкнетесь с несколькими проблемами здесь и там. Эти два решения — практически единственные решения, которые вам понадобятся, чтобы избавиться от этой проблемы, поэтому попробуйте их оба и сразу же вернитесь к игре в Minecraft!

    13071


    YouTube видео: Minecraft: Ошибка при инициализации ВМ (2 исправления)

    02, 2023




    Понравилась статья? Поделить с друзьями:
  • Error occurred during initialization of boot layer ошибка eclipse
  • Error occurred during initialization of boot layer netbeans
  • Error occurred while erasing blocks при обновлении биос
  • Error occurred while enabling is it up to date
  • Error occurred while decoding oaep padding