-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
Gradle Build daemon crashes if the environment variables contain non-ASCII characters #3117
Comments
Thanks for reporting. Notice the message I suspect something different in the file encoding or language setting for your local and Jenkins environment. In order to reproduce, I'd investigate those settings. I'm closing this issue as there's no action we can take. Please understand that we receive lots of issues and need to focus on the ones that are actionable. Here are some ways to make your issue actionable, in order of preference:
|
Can confirm this. Our builds were failing in a similar fashion and unsetting the only environment variable that had some simple characters with accents solved the issue. In our specific case Gitlab started to include user names during CI builds in environment variables like this: Which produced some suspicious log entries:
I think this happens whenever Gradle decides to fork and environment variables with UTF-8 character values are present. It is really hard to determine the exact point of crash as absolutely nothing is mentioned about in any of the logs (nor are any hs_err_pid_*.log files are present). |
I just want to know why this "EstablishBuildEnvironment" log does not appear on local environment. And perhaps how can I produce it. |
I ran into the same issue with gitlab and docker (ubuntu based image).
|
OK I'm reopening this as it's clearly affecting a number of users. @socketbind Are you running Gradle in a Docker container? If not, can you provide instructions for us to reproduce the failure (without Docker)? @blindpirate I'll move this to the icebox, since I don't have capacity to investigate further. If you get an opportunity it would be great to reproduce this issue (and I'm sure you have experience with non-ASCII characters!) |
this should fix the CI tests when people with international names make PR. ref: gradle/gradle#3117 Pull-Request: #2590
I have the same problem on my GitLab CI with a non-ascii username. The fix from @inv3rse (adding There's an error in the log when adding this fix:
I've also tried disabling the gradle-daemon by adding the flag |
@hardysim Thanks for reporting, I'd like you to provide more information:
That would help. Thanks a lot. |
This looks very much like a locale issue to me. @JehandadK @socketbind @inv3rse Could you provide some more information about this crash?
I'd appreciate these information, thank you. |
I was able to workaround this by improving the fix from @inv3rse. I've added the following to my RUN apt-get update && apt-get install -y locales && rm -rf /var/lib/apt/lists/* \
&& localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
ENV LANG en_US.UTF-8 @blindpirate my CI is the GitLab CI Runner using my docker-image from https://gitlab.com/hardysim/android-ci. The username contains a german umlaut I didn't test it locally because there's no such environment variable and a different user (I could set this up of course but as the workaround fixes the problem for me I'd like to save some time 😉). |
I've just come across the same issue.
And yes, I can reproduce it locally with the same docker image. The character I tried with is |
@zitnik maybe my updated docker-image can help you:
|
Confirmed on gradle 4.7: we get the crash from gitlab CI on every commit with french characters ("éà...") in CI_COMMIT_DESCRIPTION env variable |
Hey! We are affected as well. The issue happens on Ubuntu 18.04 even if we set locale to en-US.UTF-8 like here: mindrunner/docker-android-sdk#25 For example:
This is the log right before the sigsev: https://github.com/gradle/gradle/blob/master/subprojects/launcher/src/main/java/org/gradle/launcher/daemon/server/exec/EstablishBuildEnvironment.java#L65 Is there any workaround so far? @blindpirate ? |
For me the the hint regarding locale configuration fixed it for me, using this Dockerfile should work:
(I'm German so I prefer de_DE and Europe/Berlin since I'm already touching the locale config.) |
Cirrus puts the PR description and commit message in environment variables. These messages tend to have non ASCII characters sometimes (like emojis), which triggers a Gradle bug (gradle/gradle#3117) resulting in Gradle crashing without a helpful error message. The real solution to this problem should be fixing the Gradle bug. The better workaround on the Flutter side would be to set a UTF8 locale on the Cirrus machine, but I have yet figured out how to do it. For now to avoid more people from hitting this I'm working around by temporarily unsetting the Cirrus environment variables with the PR description and commit message. A non ASCII character to make sure it works: 😄
Cirrus puts the PR description and commit message in environment variables. These messages tend to have non ASCII characters sometimes (like emojis), which triggers a Gradle bug (gradle/gradle#3117) resulting in Gradle crashing without a helpful error message. The real solution to this problem should be fixing the Gradle bug. The better workaround on the Flutter side would be to set a UTF8 locale on the Cirrus machine, but I have yet figured out how to do it. For now to avoid more people from hitting this I'm working around by temporarily unsetting the Cirrus environment variables with the PR description and commit message. A non ASCII character to make sure it works: 😄
Cirrus puts the PR description and commit message in environment variables. These messages tend to have non ASCII characters sometimes (like emojis), which triggers a Gradle bug (gradle/gradle#3117) resulting in Gradle crashing without a helpful error message. The real solution to this problem should be fixing the Gradle bug. The better workaround on the Flutter side would be to set a UTF8 locale on the Cirrus machine, but I have yet figured out how to do it. For now to avoid more people from hitting this I'm working around by temporarily unsetting the Cirrus environment variables with the PR description and commit message. A non ASCII character to make sure it works: 😄
@davidschreiber so you're using the WIP app too, eh? And thanks @miguelslemos, we'll have to give that a try. |
Cirrus puts the PR description and commit message in environment variables. These messages tend to have non ASCII characters sometimes (like emojis), which triggers a Gradle bug (gradle/gradle#3117) resulting in Gradle crashing without a helpful error message. The real solution to this problem should be fixing the Gradle bug. The better workaround on the Flutter side would be to set a UTF8 locale on the Cirrus machine, but I have yet figured out how to do it. For now to avoid more people from hitting this I'm working around by temporarily unsetting the Cirrus environment variables with the PR description and commit message. A non ASCII character to make sure it works: 😄
@schroedingerscode not sure what WIP app is? |
Cirrus puts the PR description and commit message in environment variables. These messages tend to have non ASCII characters sometimes (like emojis), which triggers a Gradle bug (gradle/gradle#3117) resulting in Gradle crashing without a helpful error message. The real solution to this problem should be fixing the Gradle bug. The better workaround on the Flutter side would be to set a UTF8 locale on the Cirrus machine, but I have yet figured out how to do it. For now to avoid more people from hitting this I'm working around by temporarily unsetting the Cirrus environment variables with the PR description and commit message. A non ASCII character to make sure it works: 😄
The issue with the daemon crashing when there are supplementary characters (e.g. emojis and the like) in environment variables should be fixed now on current master (to be version 5.3). Gradle should just handle this seamlessly now, and even if it doesn't for some reason, it should produce a clean and descriptive error (rather than crashing). It would be great if folks who have experienced the issue could try out one of the latest nightlies and validate that this does indeed resolve the problem for them. |
Tested it this morning. Seems to be fixed !!!!! Old gradle version output (click to expand)
New gradle version output (click to expand)
|
In wich release this will be live ? |
5.3, there's a release candidate out for it now: https://docs.gradle.org/5.3-rc-3/release-notes.html |
Cirrus puts the PR description and commit message in environment variables. These messages tend to have non ASCII characters sometimes (like emojis), which triggers a Gradle bug (gradle/gradle#3117) resulting in Gradle crashing without a helpful error message. The real solution to this problem should be fixing the Gradle bug. The better workaround on the Flutter side would be to set a UTF8 locale on the Cirrus machine, but I have yet figured out how to do it. For now to avoid more people from hitting this I'm working around by temporarily unsetting the Cirrus environment variables with the PR description and commit message. A non ASCII character to make sure it works: 😄
This does not seems to be fixed completely. Still having this issue in gradle (wrapper) 5.6.3 Versions
Gradle log
Workaround
|
I was using it with docker and gitlab for Unity, the problem was indeed the non-ASCII character. My real (and this way, my GitLab) name contains an 'ó', which was passed down as an ENV variable, causing the issue. Fixed it by renaming myself on GitLab. |
I am also seeing this behavior with Gradle Sync where my computer name is an emoji character. I get the following feedback in IntelliJ: - Unknown host 'No such host is known (??)'. You may need to adjust the proxy settings in Gradle.
- java.net.UnknownHostException: ??: No such host is known (??)
- > ??: No such host is known (??) |
Expected Behavior
Gradle daemon should not get killed unexpectedly.
Current Behavior
The Gradle daemon just crashes. If the environment variables have Japanese and/or space. Though I dont know why env var are listed in logs of gradle build after Build Started is called.
Steps to Reproduce (for bugs)
This is only reproducible in my Jenkins environment with is compiling app on docker image. I cannot get to reproduce it because I cannot understand how to do the same on local machine. But logs are pretty clear and I think I have a solution.
The build keeps failing consistently and always after setting the Environment variables. So I tried removing the environment variables with Japanese characters or multiline string and this fixes. If I do the same on local machine, the environment variables don't get injected in the Gradle build process. Or at least they are not displayed in logs. If you can tell me why this happens on Jenkins/ubuntu/docker then perhaps I can reproduce this on local machine.
Your Environment
Jenkins with Docker. I am using Jenkinsfile with Declarative syntax.
The text was updated successfully, but these errors were encountered: