Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some APK never decompiled, jadx consumes GBs of memory #354

Closed
bagipro opened this issue Sep 3, 2018 · 6 comments · Fixed by #433
Closed

Some APK never decompiled, jadx consumes GBs of memory #354

bagipro opened this issue Sep 3, 2018 · 6 comments · Fixed by #433

Comments

@bagipro
Copy link
Collaborator

bagipro commented Sep 3, 2018

Hi, I've noticed that some APKs are never decompiled, but consumer 16 GBs of memory (I don't have more, so I finished it), but when I run decompilation again, it finishes successfully.
Example of such APK: https://drive.google.com/file/d/16wImr7l426R30u4X2UznHmqJrOCL5U8w/view?usp=sharing

Output of jstack:

Full thread dump Java HotSpot(TM) 64-Bit Server VM (25.74-b02 mixed mode):

"pool-1-thread-4" #13 prio=5 os_prio=0 tid=0x000000003e7f0800 nid=0x880 waiting for monitor entry [0x00000000438fe000]
   java.lang.Thread.State: BLOCKED (on object monitor)
        at jadx.core.ProcessClass.process(ProcessClass.java:26)
        - waiting to lock <0x00000004044a7f98> (a jadx.core.dex.info.ClassInfo)
        at jadx.core.ProcessClass.lambda$processDependencies$0(ProcessClass.java:51)
        at jadx.core.ProcessClass$$Lambda$14/156488300.accept(Unknown Source)
        at java.lang.Iterable.forEach(Iterable.java:75)
        at jadx.core.ProcessClass.processDependencies(ProcessClass.java:51)
        at jadx.core.ProcessClass.process(ProcessClass.java:37)
        - locked <0x00000004044aaa38> (a jadx.core.dex.info.ClassInfo)
        at jadx.api.JadxDecompiler.processClass(JadxDecompiler.java:293)
        at jadx.api.JavaClass.decompile(JavaClass.java:62)
        - locked <0x000000040180e5f0> (a jadx.api.JavaClass)
        at jadx.api.JadxDecompiler.lambda$appendSourcesSave$0(JadxDecompiler.java:201)
        at jadx.api.JadxDecompiler$$Lambda$9/1739876329.run(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)

   Locked ownable synchronizers:
        - <0x00000004017fab40> (a java.util.concurrent.ThreadPoolExecutor$Worker)

"pool-1-thread-3" #12 prio=5 os_prio=0 tid=0x000000003e7ef800 nid=0x1204 waiting for monitor entry [0x00000000429fe000]
   java.lang.Thread.State: BLOCKED (on object monitor)
        at jadx.core.ProcessClass.process(ProcessClass.java:26)
        - waiting to lock <0x00000004044a7f98> (a jadx.core.dex.info.ClassInfo)
        at jadx.api.JadxDecompiler.processClass(JadxDecompiler.java:293)
        at jadx.api.JavaClass.decompile(JavaClass.java:62)
        - locked <0x000000040180e5b0> (a jadx.api.JavaClass)
        at jadx.api.JadxDecompiler.lambda$appendSourcesSave$0(JadxDecompiler.java:201)
        at jadx.api.JadxDecompiler$$Lambda$9/1739876329.run(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)

   Locked ownable synchronizers:
        - <0x000000040182b9b8> (a java.util.concurrent.ThreadPoolExecutor$Worker)

"pool-1-thread-2" #11 prio=5 os_prio=0 tid=0x000000003ed8c800 nid=0x1548 runnable [0x0000000041afd000]
   java.lang.Thread.State: RUNNABLE
        at java.util.regex.Pattern$GroupHead.match(Pattern.java:4658)
        at java.util.regex.Pattern$Branch.match(Pattern.java:4604)
        at java.util.regex.Pattern$BranchConn.match(Pattern.java:4568)
        at java.util.regex.Pattern$GroupTail.match(Pattern.java:4717)
        at java.util.regex.Pattern$Curly.match0(Pattern.java:4279)
        at java.util.regex.Pattern$Curly.match(Pattern.java:4234)
        at java.util.regex.Pattern$GroupHead.match(Pattern.java:4658)
        at java.util.regex.Pattern$Branch.match(Pattern.java:4604)
        at java.util.regex.Pattern$BranchConn.match(Pattern.java:4568)
        at java.util.regex.Pattern$GroupTail.match(Pattern.java:4717)
        at java.util.regex.Pattern$Curly.match0(Pattern.java:4272)
        at java.util.regex.Pattern$Curly.match(Pattern.java:4234)
        at java.util.regex.Pattern$GroupHead.match(Pattern.java:4658)
        at java.util.regex.Pattern$Branch.match(Pattern.java:4604)
        at java.util.regex.Pattern$Branch.match(Pattern.java:4602)
        at java.util.regex.Pattern$BmpCharProperty.match(Pattern.java:3798)
        at java.util.regex.Pattern$Start.match(Pattern.java:3461)
        at java.util.regex.Matcher.search(Matcher.java:1248)
        at java.util.regex.Matcher.find(Matcher.java:664)
        at java.util.Formatter.parse(Formatter.java:2549)
        at java.util.Formatter.format(Formatter.java:2501)
        at java.util.Formatter.format(Formatter.java:2455)
        at java.lang.String.format(String.java:2940)
        at jadx.core.utils.InsnUtils.formatOffset(InsnUtils.java:48)
        at jadx.core.dex.nodes.BlockNode.toString(BlockNode.java:195)
        at java.lang.String.valueOf(String.java:2994)
        at java.lang.StringBuilder.append(StringBuilder.java:131)
        at jadx.core.dex.attributes.nodes.EdgeInsnAttr.toString(EdgeInsnAttr.java:46)
        at jadx.core.utils.Utils$$Lambda$40/2144900588.apply(Unknown Source)
        at jadx.core.utils.Utils.listToString(Utils.java:56)
        at jadx.core.utils.Utils.listToString(Utils.java:43)
        at jadx.core.utils.Utils.listToString(Utils.java:35)
        at jadx.core.dex.attributes.AttrList.toString(AttrList.java:28)
        at jadx.core.dex.attributes.AttributeStorage.getAttributeStrings(AttributeStorage.java:109)
        at jadx.core.dex.attributes.AttributeStorage.toString(AttributeStorage.java:120)
        at jadx.core.dex.attributes.AttrNode.getAttributesString(AttrNode.java:97)
        at jadx.core.dex.visitors.regions.RegionMaker.makeRegion(RegionMaker.java:78)
        at jadx.core.dex.visitors.regions.RegionMaker.processIf(RegionMaker.java:655)
        at jadx.core.dex.visitors.regions.RegionMaker.traverse(RegionMaker.java:122)
        at jadx.core.dex.visitors.regions.RegionMaker.makeRegion(RegionMaker.java:85)
        at jadx.core.dex.visitors.regions.RegionMaker.makeEndlessLoop(RegionMaker.java:336)
        at jadx.core.dex.visitors.regions.RegionMaker.processLoop(RegionMaker.java:171)
        at jadx.core.dex.visitors.regions.RegionMaker.traverse(RegionMaker.java:105)
        at jadx.core.dex.visitors.regions.RegionMaker.makeRegion(RegionMaker.java:85)
        at jadx.core.dex.visitors.regions.RegionMaker.makeEndlessLoop(RegionMaker.java:336)
        at jadx.core.dex.visitors.regions.RegionMaker.processLoop(RegionMaker.java:171)
        at jadx.core.dex.visitors.regions.RegionMaker.traverse(RegionMaker.java:105)
        at jadx.core.dex.visitors.regions.RegionMaker.makeRegion(RegionMaker.java:85)
        at jadx.core.dex.visitors.regions.RegionMakerVisitor.visit(RegionMakerVisitor.java:49)
        at jadx.core.dex.visitors.DepthTraversal.visit(DepthTraversal.java:27)
        at jadx.core.dex.visitors.DepthTraversal.lambda$visit$1(DepthTraversal.java:14)
        at jadx.core.dex.visitors.DepthTraversal$$Lambda$11/521131661.accept(Unknown Source)
        at java.util.ArrayList.forEach(ArrayList.java:1249)
        at jadx.core.dex.visitors.DepthTraversal.visit(DepthTraversal.java:14)
        at jadx.core.ProcessClass.process(ProcessClass.java:32)
        - locked <0x00000004044a7f98> (a jadx.core.dex.info.ClassInfo)
        at jadx.core.ProcessClass.lambda$processDependencies$0(ProcessClass.java:51)
        at jadx.core.ProcessClass$$Lambda$14/156488300.accept(Unknown Source)
        at java.lang.Iterable.forEach(Iterable.java:75)
        at jadx.core.ProcessClass.processDependencies(ProcessClass.java:51)
        at jadx.core.ProcessClass.process(ProcessClass.java:37)
        - locked <0x00000004044fba90> (a jadx.core.dex.info.ClassInfo)
        at jadx.api.JadxDecompiler.processClass(JadxDecompiler.java:293)
        at jadx.api.JavaClass.decompile(JavaClass.java:62)
        - locked <0x000000040180ccc0> (a jadx.api.JavaClass)
        at jadx.api.JadxDecompiler.lambda$appendSourcesSave$0(JadxDecompiler.java:201)
        at jadx.api.JadxDecompiler$$Lambda$9/1739876329.run(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)

   Locked ownable synchronizers:
        - <0x000000040182bf40> (a java.util.concurrent.ThreadPoolExecutor$Worker)

"pool-1-thread-1" #10 prio=5 os_prio=0 tid=0x000000003ed8c000 nid=0xaf4 waiting for monitor entry [0x0000000040bfe000]
   java.lang.Thread.State: BLOCKED (on object monitor)
        at jadx.core.ProcessClass.process(ProcessClass.java:26)
        - waiting to lock <0x00000004044a7f98> (a jadx.core.dex.info.ClassInfo)
        at jadx.core.ProcessClass.lambda$processDependencies$0(ProcessClass.java:51)
        at jadx.core.ProcessClass$$Lambda$14/156488300.accept(Unknown Source)
        at java.lang.Iterable.forEach(Iterable.java:75)
        at jadx.core.ProcessClass.processDependencies(ProcessClass.java:51)
        at jadx.core.ProcessClass.process(ProcessClass.java:37)
        - locked <0x0000000402b388f0> (a jadx.core.dex.info.ClassInfo)
        at jadx.api.JadxDecompiler.processClass(JadxDecompiler.java:293)
        at jadx.api.JavaClass.decompile(JavaClass.java:62)
        - locked <0x000000040180f598> (a jadx.api.JavaClass)
        at jadx.api.JadxDecompiler.lambda$appendSourcesSave$0(JadxDecompiler.java:201)
        at jadx.api.JadxDecompiler$$Lambda$9/1739876329.run(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)

   Locked ownable synchronizers:
        - <0x000000040182bcf8> (a java.util.concurrent.ThreadPoolExecutor$Worker)

"Service Thread" #9 daemon prio=9 os_prio=0 tid=0x000000003bba9000 nid=0xb78 runnable [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

   Locked ownable synchronizers:
        - None

"C1 CompilerThread2" #8 daemon prio=9 os_prio=2 tid=0x0000000036b19800 nid=0x14a8 waiting on condition [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

   Locked ownable synchronizers:
        - None

"C2 CompilerThread1" #7 daemon prio=9 os_prio=2 tid=0x0000000036b0e800 nid=0x1740 waiting on condition [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

   Locked ownable synchronizers:
        - None

"C2 CompilerThread0" #6 daemon prio=9 os_prio=2 tid=0x0000000036b01800 nid=0xb40 waiting on condition [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

   Locked ownable synchronizers:
        - None

"Attach Listener" #5 daemon prio=5 os_prio=2 tid=0x0000000036b00000 nid=0x16dc waiting on condition [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

   Locked ownable synchronizers:
        - None

"Signal Dispatcher" #4 daemon prio=9 os_prio=2 tid=0x0000000036afe800 nid=0x1174 runnable [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

   Locked ownable synchronizers:
        - None

"Finalizer" #3 daemon prio=8 os_prio=1 tid=0x000000000385b800 nid=0x590 in Object.wait() [0x0000000039a5f000]
   java.lang.Thread.State: WAITING (on object monitor)
        at java.lang.Object.wait(Native Method)
        - waiting on <0x000000040055e498> (a java.lang.ref.ReferenceQueue$Lock)
        at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:143)
        - locked <0x000000040055e498> (a java.lang.ref.ReferenceQueue$Lock)
        at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:164)
        at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:209)

   Locked ownable synchronizers:
        - None

"Reference Handler" #2 daemon prio=10 os_prio=2 tid=0x0000000003850800 nid=0x82c runnable [0x0000000038b5f000]
   java.lang.Thread.State: RUNNABLE
        at java.lang.Object.wait(Native Method)
        - waiting on <0x000000040055e4d8> (a java.lang.ref.Reference$Lock)
        at java.lang.Object.wait(Object.java:502)
        at java.lang.ref.Reference.tryHandlePending(Reference.java:191)
        - locked <0x000000040055e4d8> (a java.lang.ref.Reference$Lock)
        at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:153)

   Locked ownable synchronizers:
        - None

"main" #1 prio=5 os_prio=0 tid=0x0000000003762800 nid=0x9c0 waiting on condition [0x000000000375e000]
   java.lang.Thread.State: TIMED_WAITING (parking)
        at sun.misc.Unsafe.park(Native Method)
        - parking to wait for  <0x000000040182c1f0> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
        at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:215)
        at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2078)
        at java.util.concurrent.ThreadPoolExecutor.awaitTermination(ThreadPoolExecutor.java:1465)
        at jadx.api.JadxDecompiler.save(JadxDecompiler.java:147)
        at jadx.api.JadxDecompiler.save(JadxDecompiler.java:132)
        at jadx.cli.JadxCLI.processAndSave(JadxCLI.java:35)
        at jadx.cli.JadxCLI.main(JadxCLI.java:17)

   Locked ownable synchronizers:
        - None

"VM Thread" os_prio=2 tid=0x0000000036ac8000 nid=0x1188 runnable

"GC task thread#0 (ParallelGC)" os_prio=0 tid=0x0000000003777800 nid=0x1224 runnable

"GC task thread#1 (ParallelGC)" os_prio=0 tid=0x0000000003779800 nid=0xe90 runnable

"GC task thread#2 (ParallelGC)" os_prio=0 tid=0x000000000377b000 nid=0xc60 runnable

"GC task thread#3 (ParallelGC)" os_prio=0 tid=0x000000000377c800 nid=0xab8 runnable

"VM Periodic Task Thread" os_prio=2 tid=0x000000003bbab000 nid=0x814 waiting on condition

JNI global references: 323

@skylot can you please look at it? I believe it's an issue, but not just big APK

skylot added a commit that referenced this issue Sep 8, 2018
@DeveloperKurt
Copy link

Yes, with large projects I'm also having the same problem. But running it 2nd time on same folder didn't solve the problem.

@skylot
Copy link
Owner

skylot commented Nov 2, 2018

@sergey-wowwow using your apk I can't reproduce this issue. Is problem solved? Can I close it?
@ElliotCrane can you attach apk for reproducing this issue?

@bagipro
Copy link
Collaborator Author

bagipro commented Nov 2, 2018

@skylot
Sorry, I didn't notice your commit. Yes, it's fixed for that app, but still stucks on Facebook Messenger app https://drive.google.com/open?id=1XSFf3ilmKX6edWVlKAdmE6vRJO5geCR5

@CharlesWWT
Copy link

My memory is 8G, I decompile some large APK will be stuck

@jpstotz
Copy link
Collaborator

jpstotz commented Dec 15, 2018

The Facebook Messenger app (like all the Facebook apps) is quite large (>100k classes) furthermore the decompilation is limited to one thread (hard coded in code because of "freezes sometime with several threads" according to code comment).
For the Facebook Messenger app I would expect a decompilation time of may be 8 hours or more.

Decompilation of large apps with only one thread can be very time consuming. Furthermore I noticed a bug that Jadx hides the progress bar even if the decompilation is still ongoing.

@skylot
Copy link
Owner

skylot commented Feb 12, 2019

🎉 This issue has been resolved in version 0.9.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants