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

Process freezes while trying to parse large binary file #928

Closed
es3n1n opened this issue Sep 13, 2023 · 4 comments
Closed

Process freezes while trying to parse large binary file #928

es3n1n opened this issue Sep 13, 2023 · 4 comments
Assignees
Labels
need investigation Issue that needs to be investigated before any conclusion

Comments

@es3n1n
Copy link

es3n1n commented Sep 13, 2023

As you may know, there is a Wakatime plugin for the hexrays product IDA Pro, and IDA Pro stores the project info in their custom binary format, and often this file could reach a very huge size. Lately, we've been getting system crashes because wakatime-cli process keeps running with 4gbs of allocated memory, each time you make a change in your project, the new instance of wakatime-cli spawns and starts to eat your memory, resulting in a system crash(and a project changes loss too).

So what I did is I grabbed the arguments that are getting passed to wakatime-cli and tried to just run it within my python script

from subprocess import Popen
from subprocess import PIPE
from pathlib import Path


def launch(*args):
    x = Popen(args, stdout=PIPE, stderr=PIPE)
    x.wait()
    print(x.stdout.read())


wakatime_cli_path = Path('C:\\Users\\retard\\.wakatime\\wakatime-cli-windows-amd64.exe')


while True:
    launch(
        str(wakatime_cli_path.absolute()),
        '--entity', 'SomeEntity',
        '--time', '1694564455.902440',
        '--plugin', 'ida-pro/7.7 ida-pro-wakatime/1.0',
        '--local-file', 'D:\\test.i64',
        '--alternate-language', 'IDA',
        '--category', '"code reviewing"',
        '--key', 'redacted',
        '--alternate-project', 'test.i64'
    )

That's how i confirmed that when i remove the local-file path it works just fine.

When the process froze I checked the opened handles and found the handle to the file, considering that i think you guys can add some flag that would disable all the logic related to this file. I uploaded a .i64 file that causes the process to allocate the memory for it and just freeze, you can try to pass it to the wakatime-cli and you'll see what i mean.

Expected behavior (what should have happened): wakatime-cli should send the heartbeat and gracefully exit without eating your whole ram

Actual behavior (what went wrong): wakatime-cli keeps running resulting in many instances running at the same time and the system crashes with a blue screen on Windows :^)

Environment:

  • OS: tested only on windows64
  • Platform: amd64

Logs:
there's none

@gandarez gandarez self-assigned this Sep 13, 2023
@gandarez gandarez added need investigation Issue that needs to be investigated before any conclusion and removed triage labels Sep 13, 2023
@gandarez
Copy link
Member

gandarez commented Sep 13, 2023

@es3n1n I can't download that file as it's broken for me. Is there another way to share with us? Maybe WeTransfer?

@es3n1n
Copy link
Author

es3n1n commented Sep 13, 2023

@es3n1n I can't download that file as it's broken for me. Is there another way to share with us? Maybe WeTransfer?

Reuploaded it to the WeTransfer

@gandarez
Copy link
Member

A new lexer is needed in order to avoid wakatime-cli detecting it as Objective C and hanging forever trying to read it. As soon as this PR gets merged and released you'll need to close the IDE and reopen to update the cli version.

@es3n1n
Copy link
Author

es3n1n commented Sep 13, 2023

Can confirm that everything works as expected on the latest preview release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need investigation Issue that needs to be investigated before any conclusion
Projects
Status: Done
Development

No branches or pull requests

2 participants