question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

FR: Allow specifying JVM flags for Java-based emulators

See original GitHub issue

[REQUIRED] Environment info

firebase-tools: 8.6.0

Platform: Windows 10, Chrome 84.0.4147.105

[REQUIRED] Test case

I have no instructions to reproduce this issue, but I can describe the circumstances of it occurring

I have a large ruleset (around 60Ko) and many tests (200+) covering most of my ruleset.

When trying to visualize the report at http://localhost:8080/emulator/v1/projects/my-firebase-project:ruleCoverage I will get an error “sometimes”, the only solution is then to restart the emulator and hope it will work the next time.

It seems that the report generation in Chrome is exhausting the capabilities of my laptop…

[REQUIRED] Steps to reproduce

See above

[REQUIRED] Expected behavior

Report should be generated

[REQUIRED] Actual behavior

http://localhost:8080/emulator/v1/projects/my-firebase-project:ruleCoverage {“error”:{“code”:500,“message”:“Internal”,“status”:“INTERNAL”}}

firestore-debug.log Aug 04, 2020 9:52:10 AM io.gapi.emulators.netty.HttpHandler$1 onError INFO: Exception when handling request: Java heap space

How would I increase the “Java heap space” for the emulator?

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:2
  • Comments:29 (14 by maintainers)

github_iconTop GitHub Comments

5reactions
yuchenshicommented, Sep 15, 2020

Thanks, @olivierkrener! I’ll repurpose this issue to track a better way to specify JVM flags in firebase emulators:start without having to dig out the jar.

3reactions
ezmegycommented, Aug 13, 2021

I’m not sure why but for me running the raw command

java -Xmx4g -Duser.language=en -jar /Users/peterm/.cache/firebase/emulators/cloud-firestore-emulator-v1.13.1.jar --host localhost --port 5050 --seed_from_export /Users/peterm/pathToMyBackupData/myBackupData.overall_export_metadata --rules /Users/peterm/pathToMyFirestoreRules/firestore.rules --functions_emulator localhost:5001 node /Users/peterm/.cache/firebase/emulators/ui-v1.6.0/server.bundle.js

didn’t do it. It said the Dev App Server was running but just couldn’t get the emulator UI to start working.

(Note1: tried “0.0.0.0” and “127.0.0.1” instead localhost as well. Note2: the port numbers above are reflected in my firebase.json file.)

But setting the java tool option to 4gigs in the environment variable did the trick:

export JAVA_TOOL_OPTIONS="-Xmx4g" (on mac)

So would definitely vote for adding this latter to the docs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

1.2 Enable Options/Flags for JVM Troubleshooting
This section describes setting up JVM options/flags to enable gathering relevant data for troubleshooting. The data you gather depends on the system and ......
Read more >
Using Linux's memfd_secret syscall from the JVM with JEP-419
java ): if this flag is not specified, users will get a warning for the first call to a restricted method (one warning...
Read more >
Java Virtual Machine Emulator - jvm - Stack Overflow
I want to execute java bytecode (JVM Instructions) line by line and also want to see the stack value, registers etc. like wise...
Read more >
Installing Java - Fedora Docs
If you want to run a Java program, you can do that on a JVM (Java Virtual Machine), which is provided with the...
Read more >
Configure Java properly using flags/options | CodeX - Medium
You can view the flags used in your java application in multiple ways. Either by specifying a flag on the command line (-XX:+PrintFlagsFinal)...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found