fastlane: Rare crash on startup in fastlane_folder.rb: in `join': no implicit conversion of nil into String
New Issue Checklist
- Updated fastlane to the latest version
- I read the Contribution Guidelines
- I read docs.fastlane.tools
- I searched for existing GitHub issues
Issue Description
We currently run fastlane-2.96.0 on a build server (running buildbot-1.2.0), and occasionally notice a build failure due to one of fastlane’s actions failing. The actual action itself seems to be irrelevant (cert, sigh, etc.), however it seems to happen more often when the build server machine is under a heavy load.
Rerunning the build again shortly after the build fails has so far always succeeded, so this is more or less a small annoyance than anything problematic.
We also haven’t seen this happen before 2.96.0.
I am aware we aren’t using the latest version of fastlane right now, but I decided to submit this report before I forget about it. 😃 I’ll update to 2.98.0 right after this and post a reply here if I see it happen again after the update.
I’ll also mention that fastlane suggests I run “gem cleanup” to speed up the launch, but we already do this after every fastlane update. The build machine simultaneously runs multiple compiler processes across multiple VMs, so an occasional slow start is not at all unexpected for our use case.
Complete output when running fastlane, including the stack trace and command used
bash -c 'env FASTLANE_PASSWORD=$(< fastlane/xyz.key.txt) fastlane cert'
in dir /Volumes/Buildbot/buildbot-osx/CrystalClash-iOS/build (timeout 1200 secs)
watching logfiles {}
argv: ['bash', '-c', 'env FASTLANE_PASSWORD=$(< fastlane/xyz.key.txt) fastlane cert']
environment:
Apple_PubSub_Socket_Render=/private/tmp/com.apple.launchd.i0vQVsLZRk/Render
DISPLAY=/private/tmp/com.apple.launchd.htpenpkJin/org.macosforge.xquartz:0
EDITOR=vi
HOME=/Users/falken
LC_CTYPE=UTF-8
LOGNAME=falken
PATH=/Users/falken/.fastlane/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin
PWD=/Volumes/Buildbot/buildbot-osx/CrystalClash-iOS/build
SECURITYSESSIONID=186a6
SHELL=/bin/bash
SHLVL=1
SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.GtMWyocuk4/Listeners
TERM=xterm-256color
TERM_PROGRAM=Apple_Terminal
TERM_PROGRAM_VERSION=404
TERM_SESSION_ID=21E43212-25DB-484D-9BE5-BD234D17C8A1
TMPDIR=/var/folders/_y/bk85gnj92fj_mlk9x1c8nm0w0000gn/T/
USER=falken
XPC_FLAGS=0x0
XPC_SERVICE_NAME=0
_=/usr/local/bin/buildbot-worker
__CF_USER_TEXT_ENCODING=0x1F5:0x0:0x0
using PTY: False
[21:57:35]: Seems like launching fastlane takes a while - please run
[21:57:35]:
[21:57:35]: $ [sudo] gem cleanup
[21:57:35]:
[21:57:35]: to uninstall outdated gems and make fastlane launch faster
[21:57:35]: Alternatively it's recommended to start using a Gemfile to lock your dependencies
[21:57:35]: To get started with a Gemfile, run
[21:57:35]:
[21:57:35]: $ bundle init
[21:57:35]: $ echo 'gem "fastlane"' >> Gemfile
[21:57:35]: $ bundle install
[21:57:35]:
[21:57:35]: After creating the Gemfile and Gemfile.lock, commit those files into version control
[21:57:35]: Get started using a Gemfile for fastlane https://docs.fastlane.tools/getting-started/ios/setup/#use-a-gemfile
/Users/falken/.fastlane/bin/bundle/lib/ruby/gems/2.2.0/gems/fastlane-2.96.0/fastlane_core/lib/fastlane_core/fastlane_folder.rb:49:in `join': no implicit conversion of nil into String (TypeError)
from /Users/falken/.fastlane/bin/bundle/lib/ruby/gems/2.2.0/gems/fastlane-2.96.0/fastlane_core/lib/fastlane_core/fastlane_folder.rb:49:in `fastfile_path'
from /Users/falken/.fastlane/bin/bundle/lib/ruby/gems/2.2.0/gems/fastlane-2.96.0/fastlane/lib/fastlane/cli_tools_distributor.rb:167:in `available_lanes'
from /Users/falken/.fastlane/bin/bundle/lib/ruby/gems/2.2.0/gems/fastlane-2.96.0/fastlane/lib/fastlane/cli_tools_distributor.rb:74:in `take_off'
from /Users/falken/.fastlane/bin/bundle/lib/ruby/gems/2.2.0/gems/fastlane-2.96.0/bin/fastlane:20:in `<top (required)>'
from /Users/falken/.fastlane/bin/bundle/bin/fastlane:22:in `load'
from /Users/falken/.fastlane/bin/bundle/bin/fastlane:22:in `<main>'
program finished with exit code 1
elapsedTime=8.027540
Environment
🚫 fastlane environment 🚫
Stack
| Key | Value |
|---|---|
| OS | 10.13.5 |
| Ruby | 2.2.4 |
| Bundler? | false |
| Git | git version 2.15.2 (Apple Git-101.1) |
| Installation Source | ~/.fastlane/bin/bundle/bin/fastlane |
| Host | Mac OS X 10.13.5 (17F77) |
| Ruby Lib Dir | ~/.fastlane/bin/bundle/lib |
| OpenSSL Version | OpenSSL 1.0.2g 1 Mar 2016 |
| Is contained | false |
| Is homebrew | true |
| Is installed via Fabric.app | false |
| Xcode Path | /Applications/Xcode.app/Contents/Developer/ |
| Xcode Version | 9.4.1 |
System Locale
| Variable | Value | |
|---|---|---|
| LANG | en_US.UTF-8 | ✅ |
| LC_ALL | en_US.UTF-8 | ✅ |
| LANGUAGE | en_US.UTF-8 | ✅ |
fastlane files:
No Fastfile found
fastlane gems
| Gem | Version | Update-Status |
|---|---|---|
| fastlane | 2.96.0 | 🚫 Update available |
Loaded fastlane plugins:
No plugins Loaded
Loaded gems
| Gem | Version |
|---|---|
| slack-notifier | 2.3.2 |
| atomos | 0.1.2 |
| CFPropertyList | 2.3.5 |
| claide | 1.0.2 |
| colored2 | 3.1.2 |
| nanaimo | 0.2.4 |
| xcodeproj | 1.5.7 |
| rouge | 1.11.1 |
| xcpretty | 0.2.6 |
| terminal-notifier | 1.7.1 |
| unicode-display_width | 1.1.3 |
| terminal-table | 1.7.3 |
| plist | 3.2.0 |
| public_suffix | 2.0.5 |
| addressable | 2.5.1 |
| multipart-post | 2.0.0 |
| word_wrap | 1.0.0 |
| tty-screen | 0.6.4 |
| tty-cursor | 0.5.0 |
| tty-spinner | 0.8.0 |
| babosa | 1.0.2 |
| colored | 1.2 |
| highline | 1.7.8 |
| commander-fastlane | 4.4.6 |
| excon | 0.55.0 |
| faraday | 0.12.1 |
| unf_ext | 0.0.7.4 |
| unf | 0.1.4 |
| domain_name | 0.5.20170404 |
| http-cookie | 1.0.3 |
| faraday-cookie_jar | 0.0.6 |
| fastimage | 2.1.0 |
| gh_inspector | 1.1.3 |
| json | 1.8.1 |
| mini_magick | 4.5.1 |
| multi_json | 1.12.1 |
| multi_xml | 0.6.0 |
| rubyzip | 1.2.1 |
| security | 0.1.3 |
| xcpretty-travis-formatter | 0.0.4 |
| dotenv | 2.2.0 |
| bundler | 1.14.6 |
| faraday_middleware | 0.11.0.1 |
| naturally | 2.1.0 |
| simctl | 1.6.4 |
| uber | 0.0.15 |
| declarative | 0.0.9 |
| declarative-option | 0.1.0 |
| representable | 3.0.4 |
| retriable | 2.1.0 |
| mime-types-data | 3.2016.0521 |
| mime-types | 3.1 |
| little-plugger | 1.1.4 |
| logging | 2.2.2 |
| jwt | 1.5.6 |
| memoist | 0.15.0 |
| os | 0.9.6 |
| signet | 0.7.3 |
| googleauth | 0.5.1 |
| httpclient | 2.8.3 |
| google-api-client | 0.21.2 |
| emoji_regex | 0.1.1 |
| libxml-ruby | 3.0.0 |
generated on: 2018-06-23
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 4
- Comments: 121 (71 by maintainers)
Good news: I think I got it: #13918
I could reproduce the error pretty consistently locally and on Azure Pipelines. Disabling the update made it go away in 100% of the cases, opting out of Analytics did as well. So I looked into the Analytics a bit and discovered that this specific data was not used any more - so I could simply remove the code. #13918 is the PR doing that, and with the next release the problem should be gone.
Another occurence with
2.108.0on Azure Devops Pipelines (CI): https://github.com/fastlane/fastlane/issues/13680Ahah, I’ve not tried yet with the latest version as I was not able to update the CI on our side. I was just wondering if you fixed all paths you discovered. If so, we’ll update soon and let you know, so we can hopefully close this issue 😃
Yes we do have Appfile
Hi!
I did wait a bit to provide results but since we set FASTLANE_SKIP_UPDATE_CHECK=1, we’ve not seen the issue 😕. Before we had it everyday and now nothing since three days.
@janpio Will do a test with FASTLANE_SKIP_UPDATE_CHECK and let you know.
My setup on Azure Pipelines (the CI build 335 etc) and that repo is “special”, in that I start a normal fastlane run and use the
shaction to start another fastlane run inside it. So Pipelines executes thebundle exec fastlane allcommand, which itself then starts anotherbundle exec fastlane screengrab init(in the case of 335) which then crashes. That is why the Stacktrace there looks different and “convoluted”.The “real” stacktrace of the “inner” fastlane is output as soon as it crashes. That crash is then bubbled up to the “outer” fastlane, which doesn’t handle it and adds its own stacktrace for that.
For the other people reporting here in this issue, they do no such funny stuff but just execute a command manually or on CI and encounter the crash with the output and stacktrace they posted.
It might be a coincidence that my matrjoschka style setup triggers a similar problem - or might just be another way to trigger the exact same problem.
That being said:
https://janpio.visualstudio.com/fastlane-e2e-tests/_build/results?buildId=117 and https://janpio.visualstudio.com/fastlane-e2e-tests/_build/results?buildId=256 (Linux) are two other full outputs of my setup.
But https://github.com/fastlane/fastlane/issues/12789#issue-335105535 https://github.com/fastlane/fastlane/issues/12789#issuecomment-430482522 https://github.com/fastlane/fastlane/issues/12789#issuecomment-443172562 https://github.com/fastlane/fastlane/issues/12789#issuecomment-445028889 https://github.com/fastlane/fastlane/issues/12789#issuecomment-445049874 are also full outputs (some with the pure release of fastlane, some with different stages of our
putsdebugging included) - they are just very short as fastlane crashes very early in the “startup” and isn’t wrapper in another fastlane run.@janpio I’m looking at that old build (335), and I also cloned that same repo locally and ran the
bundle exec fastlane allcommand and got the same error (with ajoinand aTypeError)Looking at the full debug output in that build and my build locally it doesn’t like that
fastlane_folder.rbis the cause, it’s another shell script that’s causing the error. I wonder if the root cause of the original issue might be an unhandled shell command/exception? Or an over-rescued exception in one of the shell runner commands?Do you have any more examples (full output) we can look at? The other example in this thread looks like it’s truncated to just show the
putsstatements.@janpio
@janpio I’m visiting from the SO post because it’s a little easier to have the discussion here than in the comments boxes. I don’t use fastlane or write ios/swift code I just think this is an interesting Ruby behavior so I’d like to try and help.
Have you tried throwing the pry/pry-byebug gems into your fastlane gemspec (you’ll want to add them as dependencies, rather than development dependencies I think)?
You could use a
rescue TypeError => ewith abinding.pryinside thatself.pathmethod to inspect the environment when it errors. Note: Don’t use a branch with that in your production code or a CI runnerI’m trying to recreate a local environment to reproduce the error. I pushed up a public repo here: https://github.com/jaydorsey/FastlaneDemo
Everything seems to work (e.g. I can run
bundle exec fastlane ios custom_lane) but I’m not 100% sure I’m recreating what you guys are testing. Mainly because I couldn’t make it break. If someone can take a look at it I’d appreciate it?I did get all the debug output, but even when I ran this 100 times in a loop nothing broke. Ruby 2.5.3 with readline support, macos 10.14.1.
As I mentioned on the SO post, one immediate change that could be made is making the
value ||=assignments straight up returns because||=isn’t thread safe. I think areturnis a little more expressive as well. Would still like to see if the root cause can be identified so if anyone is able to make a PR on my repo with a reproducible (even intermittently) change that would be cool 👍@janpio: I still only very rarely see this happen (nowhere near as often as the others here have been able to repro it), but here’s my environment as a datapoint to help narrow things down:
concurrent = 2so both macOS and iOS builds are performed simultaneously, but only the iOS build calls out to fastlane)Yeah, I’ve checked that: we have two
Dir.chdirbut inside actions (and using the closure version). We have 2sh("cd ...")as well, but inside lanes.Pasting the full output here without redacting anything just to make sure I’m not messing something:
Here’s what I get:
I assume some of those should be printed with double quotes to fill the values 😅
@marcelofabri Now we’re talking. Console log debugging via a branch on a Github repo… something I don’t do every day 😉
I added a few
putsinsidecli_tools_distributor.rbandfastlane_folder.rb. Because what I see in your output doesn’t really make sense, does it? Why can the path becomenilwhen we are in the same folder as before?Please run run
bundle installto install2.109.1.foo1and run it again 🌪@janpio here’s what I got:
@janpio I already found and linked the relevant issue, see above.
I was aware of that, I thought they were connected since the error message was the same, but yeah I’ll try to do better with searching for an existing issue that fits 😉