Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Accelerated (with HAXM) android mac emulator freezes

Situation: I have android x86 accelerated emulator on Mac OS X. It starts normally (and shows HAX is working and emulator runs in fast virt mode line) and I can run programs. After program being launched emulator works some time and freezes, so I cannot interact with it.

Example: if I call adb shell ls -l /sdcard/ (or many other adb commands) nothing is printed in console and I must press control+C to return control.

After emulator restart problem vanishes and after time it occurs again.

Works right on not-accelerated emulator. Works wrong only with HAXM turned on.

I have tried to

  • Reinstall android SDK
  • Create emulators with different properties
  • Run on another mac machine
  • Reboot emulator/computer
  • Enable 64-bit Kernel and Extensions (was disabled)

I need to make emulator working all the time (not only first N minutes).

That's not a duplicate to this question because of:

  1. Mac OS X version is lower than 10.9 and I cannot use hotfix Intel provided
  2. No crash observed here
  3. Computer doesn't freeze (but emulator stops work)
  4. Freeze occurs after emulator has been working for time (up to 30 min)

Possibly relates to this question, but

  1. cannot analyze is it the same question
  2. no helpful answers there

System information:

Model Identifier:iMac10,1

Memory:8 GB

System Version:Mac OS X 10.6.8 (10K549)

Kernel Version:Darwin 10.8.0

HAXM release 1.0.6

It met Intel requirements

Supported Operating Systems:

Mac OS X* 10.6 Snow Leopard and 10.7 Lion (32/64-bit)

Making setup I followed instructions from developer.android. I allocated 2048 Mb during HAXM install and created emulator with 512 Mb RAM.

There are some messages in dmesg in the meantime. History:

1) After emulator was started (it works)

Kext com.intel.kext.intelhaxm not found for unload request.
13

  possible map ffffffffffffffff cpu_online_map 3
haxm_error: fc_msr haxm_error: fc_msr 5
5
haxm_error: vt_enablhaxm_error: vt_enable e 1
haxm_error: nx_enable 1
haxm_error: nx_enable 2048
2048
haxm_error: ---- HAXM release 1.0.6 --------
haxm_error: This log collects runnging status of HAXM driver.

haxm_error: set memlimit 0x80000000

2) After some time passed (it still works!)

23

 possible map ffffffffffffffff cpu_online_map 3
haxm_error: fc_msr h5
axm_error: fc_msr h5
ahaxm_error: vt_enable xm_error: vt_enable 1
1
haxm_error: nx_haxm_error: nx_enable ena2048
ble 2048
haxm_error: ---- HAXM release 1.0.6 --------
haxm_error: This log collects runnging status of HAXM driver.

.......hax_vm_create_ui 0
cvcpu 0x1d803000 vmid 0 vcpu_id 0
minor id 1000before the crate node
setup hax tunnel request for already setup one
haxm_error: hax_vm_alloc_ram: size 0x20000000
haxm_error: !VM_STATE_FLAGS_MEM_ALLOC
haxm_error: Memory allocation, va:123787000, size:20000000
haxm_error: !VM_STATE_FLAGS_MEM_ALLOC: spare_ram 0x5800000
haxm_error: hax_vm_alloc_ram: size 0x20000
haxm_error: spare alloc: mem_limit 0x0, size 0x20000, spare_ram 0x5800000
haxm_error: VM_STATE_FLAGS_MEM_ALLOC: spare_ram 0x5800000
haxm_error: hax_vm_alloc_ram: size 0x20000
haxm_error: spare alloc: mem_limit 0x0, size 0x20000, spare_ram 0x5800000
haxm_error: VM_STATE_FLAGS_MEM_ALLOC: spare_ram 0x5800000
haxm_error: 
...........hax_teardown_vm
.......hax_vm_create_ui 0
cvcpu 0x1d585800 vmid 0 vcpu_id 0
minor id 1000before the crate node
setup hax tunnel request for already setup one
haxm_error: hax_vm_alloc_ram: size 0x20000000
haxm_error: !VM_STATE_FLAGS_MEM_ALLOC
haxm_error: Memory allocation, va:123637000, size:20000000
haxm_error: !VM_STATE_FLAGS_MEM_ALLOC: spare_ram 0x5800000
haxm_error: hax_vm_alloc_ram: size 0x20000
haxm_error: spare alloc: mem_limit 0x0, size 0x20000, spare_ram 0x5800000
haxm_error: VM_STATE_FLAGS_MEM_ALLOC: spare_ram 0x5800000
haxm_error: hax_vm_alloc_ram: size 0x20000
haxm_error: spare alloc: mem_limit 0x0, size 0x20000, spare_ram 0x5800000
haxm_error: VM_STATE_FLAGS_MEM_ALLOC: spare_ram 0x5800000
haxm_error: 
...........hax_teardown_vm
.......hax_vm_create_ui 0
cvcpu 0x1d7a8800 vmid 0 vcpu_id 0
minor id 1000before the crate node
setup hax tunnel request for already setup one
haxm_error: hax_vm_alloc_ram: size 0x20000000
haxm_error: !VM_STATE_FLAGS_MEM_ALLOC
haxm_error: Memory allocation, va:123637000, size:20000000
haxm_error: !VM_STATE_FLAGS_MEM_ALLOC: spare_ram 0x5800000
haxm_error: hax_vm_alloc_ram: size 0x20000
haxm_error: spare alloc: mem_limit 0x0, size 0x20000, spare_ram 0x5800000
haxm_error: VM_STATE_FLAGS_MEM_ALLOC: spare_ram 0x5800000
haxm_error: hax_vm_alloc_ram: size 0x20000
haxm_error: spare alloc: mem_limit 0x0, size 0x20000, spare_ram 0x5800000
haxm_error: VM_STATE_FLAGS_MEM_ALLOC: spare_ram 0x5800000

3) After emulator hung

.......hax_vm_create_ui 0
cvcpu 0xf5e5000 vmid 0 vcpu_id 0
minor id 1000before the crate node
setup hax tunnel request for already setup one
haxm_error: hax_vm_alloc_ram: size 0x20000000
haxm_error: !VM_STATE_FLAGS_MEM_ALLOC
haxm_error: Memory allocation, va:123641000, size:20000000
haxm_error: !VM_STATE_FLAGS_MEM_ALLOC: spare_ram 0x5800000
haxm_error: hax_vm_alloc_ram: size 0x20000
haxm_error: spare alloc: mem_limit 0x0, size 0x20000, spare_ram 0x5800000
haxm_error: VM_STATE_FLAGS_MEM_ALLOC: spare_ram 0x5800000
haxm_error: hax_vm_alloc_ram: size 0x20000
haxm_error: spare alloc: mem_limit 0x0, size 0x20000, spare_ram 0x5800000
haxm_error: VM_STATE_FLAGS_MEM_ALLOC: spare_ram 0x5800000

Please excuse me for all these similar logs but I do hope they can help in diagnostics. I didn't find other output facing with freezes.

Am I doing something wrong here? Can I somehow fix/workaround these freezes?

P.S.

$ top 
PID    COMMAND      %CPU TIME     #TH  #WQ  #POR #MREG RPRVT  RSHRD  RSIZE  VPRVT  VSIZE  PGRP  PPID  STATE    UID  FAULTS    COW     MSGSENT    MSGRECV    SYSBSD     SYSMACH   CSW        PAGEINS
35308  emulator64-x 99.9 93:35.44 2/1  1    67   114   13M    18M-   179M   297M   3459M  35303 35303 running  503  180922    477     134488     1390       604431027+ 1732      83769+     7
like image 298
Sergey Fedorov Avatar asked Apr 09 '14 15:04

Sergey Fedorov


1 Answers

Not sure if you still running into this issue or not but your on an older release of Intel's HAXM. The current release is: HAX 1.0.8 Download

I saw your post and kept getting a crash.

When tailing the /var/log/system.log on Mac OSX 10.9 I would see your above messages. When I tried to reinstall the HAX I would see the below:

Aug 19 12:03:55 3c15c2cf84fe kernel[0]: haxm_error: -------- HAXM release 1.0.7 --------
Aug 19 12:03:55 3c15c2cf84fe kernel[0]: haxm_error: This log collects runnging status of HAXM driver.
Aug 19 12:03:55 3c15c2cf84fe kernel[0]: haxm_error: set memlimit 0x80000000

I was able to resolve my issue by removing all of the AVD's that I created with Android Studio. From the AVD (Android Virtual Devices) just "Delete" all the emulators in your Virtual devices. Then start over.

If you get the below ERROR:

enter image description here

Do the following:

  1. Open up a Terminal Window.
  2. Type: ~/.android/avd
  3. From here remove everything by this command: rm -rf .
  4. NOTE: you will delete everything in the path that you run it from. All ways good to do: pwd <-- Print working directory so see what you will be removing.
  5. Start up the AVD again and recreate the devices you want.

I hope that helps someone.

like image 94
JamesDeHart Avatar answered Oct 26 '22 16:10

JamesDeHart