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

Rare crash on startup in fastlane_folder.rb: in `join': no implicit conversion of nil into String #12789

Closed
4 tasks done
falken42 opened this issue Jun 23, 2018 · 121 comments
Closed
4 tasks done

Comments

@falken42
Copy link

falken42 commented Jun 23, 2018

New Issue Checklist

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 `'
	from /Users/falken/.fastlane/bin/bundle/bin/fastlane:22:in `load'
	from /Users/falken/.fastlane/bin/bundle/bin/fastlane:22:in `'
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

@joshdholtz
Copy link
Member

@falken42 This is super weird, TBH 😬 The lines is causing confusion is... https://github.com/fastlane/fastlane/blob/master/fastlane/lib/fastlane/cli_tools_distributor.rb#L74

Its not seeing cert as a valid tool name so its trying to show available lanes which isn't a thing for you because you don't have any. And it this is happening just randomly it sounds like it might just be something with your machine and its heavy load 😔

Can you try downgrading to something pre-2.96.0 to see if you do actually stop getting this random error again? 🤔

@cojoj
Copy link

cojoj commented Jul 5, 2018

I have the very same issue form some time now... I thought new versions of fastlane will solve it, but so far no luck.

I have this issue when I run my builds in CircleCI. As @falken42 has mentioned - it's a random thing, so I cannot determine exactly what's happening and what's causing the problem. Sometimes I have to rerun workflow multiple times, to pass, but sometimes it works on the first run!

In my CircleCI's workflow I have two jobs speficied, and this always fails for me when I run the first one. If it completes I'm sure the second job will complete as well!
This job calls only one fastlane actions and it is:

bundle exec fastlane scan

I have also two ENV variables set:

SCAN_DEVICE: "iPhone 6"
SCAN_SCHEME: "home24 - Staging"

@falken42
Copy link
Author

falken42 commented Jul 5, 2018

@joshdholtz I went back and did a deep dive through our buildbot logs, and it turns out this actually has happened with previous versions of fastlane. My original statement that we hadn't seen this before 2.96.0 was incorrect, sorry about that.

Log from fastlane-2.85.0:

fastlane sigh manage -e -f
 in dir /Volumes/Buildbot/buildbot-osx/CrystalClash-iOS/build (timeout 1200 secs)
 watching logfiles {}
 argv: ['fastlane', 'sigh', 'manage', '-e', '-f']
 environment:
  Apple_PubSub_Socket_Render=/private/tmp/com.apple.launchd.2j8KZClksG/Render
  DISPLAY=/private/tmp/com.apple.launchd.rAO2EqRAku/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=186a8
  SHELL=/bin/bash
  SHLVL=1
  SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.I7zyoYjKSk/Listeners
  TERM=xterm-256color
  TERM_PROGRAM=Apple_Terminal
  TERM_PROGRAM_VERSION=400
  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
[19:24:57]: Seems like launching fastlane takes a while - please run
[19:24:57]: 
[19:24:57]: $ [sudo] gem cleanup
[19:24:57]: 
[19:24:57]: to uninstall outdated gems and make fastlane launch faster
[19:24:57]: Alternatively it's recommended to start using a Gemfile to lock your dependencies
[19:24:57]: To get started with a Gemfile, run
[19:24:57]: 
[19:24:57]: $ bundle init
[19:24:57]: $ echo 'gem "fastlane"' >> Gemfile
[19:24:57]: $ bundle install
[19:24:57]: 
[19:24:57]: After creating the Gemfile and Gemfile.lock, commit those files into version control
[19:24:57]: 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.85.0/fastlane_core/lib/fastlane_core/fastlane_folder.rb:52: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.85.0/fastlane_core/lib/fastlane_core/fastlane_folder.rb:52:in `fastfile_path'
	from /Users/falken/.fastlane/bin/bundle/lib/ruby/gems/2.2.0/gems/fastlane-2.85.0/fastlane/lib/fastlane/cli_tools_distributor.rb:157:in `available_lanes'
	from /Users/falken/.fastlane/bin/bundle/lib/ruby/gems/2.2.0/gems/fastlane-2.85.0/fastlane/lib/fastlane/cli_tools_distributor.rb:64:in `take_off'
	from /Users/falken/.fastlane/bin/bundle/lib/ruby/gems/2.2.0/gems/fastlane-2.85.0/bin/fastlane:20:in `'
	from /Users/falken/.fastlane/bin/bundle/bin/fastlane:22:in `load'
	from /Users/falken/.fastlane/bin/bundle/bin/fastlane:22:in `'
program finished with exit code 1
elapsedTime=5.721645

Two more data points: the very first fastlane version we began using was 2.41.0, and the last version that didn't exhibit this error was with 2.64.1.

It might be purely coincidental, but it seems like we started seeing this once fastlane began to suggest we run "gem cleanup". At least, every time fastlane fails, the suggestion to run gem cleanup is always in the log.

I've currently updated fastlane to 2.98.0 and haven't seen it repro here yet. It is possible for us to downgrade, but I can't downgrade too far (there are newer deliver and supply features that we depend on to deploy our apps). If there is a specific target version you'd like me to test, let me know and I can see if we can use it.

@falken42
Copy link
Author

falken42 commented Jul 7, 2018

We just had this happen with 2.98.0:

fastlane sigh manage -e -f
 in dir /Volumes/Buildbot/buildbot-osx/Sandbox-iOS/build (timeout 1200 secs)
 watching logfiles {}
 argv: ['fastlane', 'sigh', 'manage', '-e', '-f']
 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/Sandbox-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
[02:36:39]: 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.98.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.98.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.98.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.98.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.98.0/bin/fastlane:20:in `'
	from /Users/falken/.fastlane/bin/bundle/bin/fastlane:22:in `load'
	from /Users/falken/.fastlane/bin/bundle/bin/fastlane:22:in `'
program finished with exit code 1
elapsedTime=5.697607

One thing that's different this time though is fastlane isn't suggesting to run "gem cleanup", it just simply failed.

@fastlane-bot
Copy link

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.

Please make sure to update to the latest fastlane version and check if that solves the issue. Let us know if that works for you by adding a comment 👍

@falken42
Copy link
Author

falken42 commented Aug 7, 2018

We've updated to 2.100.1 about a week ago, but I haven't seen a repro yet.

@eriadam
Copy link

eriadam commented Aug 27, 2018

2.102.0

+ fastlane deliver --skip_screenshots
[11:48:58]: �[33mGet started using a Gemfile for fastlane https://docs.fastlane.tools/getting-started/ios/setup/#use-a-gemfile�[0m
/usr/local/lib/ruby/gems/2.5.0/gems/fastlane-2.102.0/fastlane_core/lib/fastlane_core/fastlane_folder.rb:49:in `join': no implicit conversion of nil into String (TypeError)
	from /usr/local/lib/ruby/gems/2.5.0/gems/fastlane-2.102.0/fastlane_core/lib/fastlane_core/fastlane_folder.rb:49:in `fastfile_path'
	from /usr/local/lib/ruby/gems/2.5.0/gems/fastlane-2.102.0/fastlane/lib/fastlane/cli_tools_distributor.rb:167:in `available_lanes'
	from /usr/local/lib/ruby/gems/2.5.0/gems/fastlane-2.102.0/fastlane/lib/fastlane/cli_tools_distributor.rb:74:in `take_off'
	from /usr/local/lib/ruby/gems/2.5.0/gems/fastlane-2.102.0/bin/fastlane:20:in `<top (required)>'
	from /usr/local/bin/fastlane:23:in `load'
	from /usr/local/bin/fastlane:23:in `<main>'

@jamezilla
Copy link

jamezilla commented Aug 27, 2018

I also ran into this on 2.102.0. It was not an intermittent failure.

Uninstalled fastlane & commander-fastlane, then reinstalled and it started working again.

@falken42
Copy link
Author

I honestly wasn't expecting to see this happen again.

We've moved to GitLab CI (instead of buildbot), and our macOS builder is no longer under the same heavy load as it was when I first posted this report.

But yet, our pipeline just randomly failed today:

$ bash -c 'env FASTLANE_PASSWORD=`vault kv get -field=password secret/ci/apple-developer` fastlane sigh --development'
[14:02:09]: 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.101.1/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.101.1/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.101.1/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.101.1/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.101.1/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>'
ERROR: Job failed: exit status 1

As usual, retrying the pipeline worked without any problems.

@fastlane-bot

This comment has been minimized.

@fastlane-bot

This comment has been minimized.

@eriadam
Copy link

eriadam commented Oct 12, 2018

Still happening with fastlane-2.105.2.

@falken42
Copy link
Author

Also repro'd again with fastlane-2.105.2 here as well.

It's pretty rare, happening once out of every 70-80 or so builds for us. Retrying the pipeline immediately afterwards is always successful.

$ bash -c 'env FASTLANE_PASSWORD=`vault kv get -field=password secret/ci/apple-developer` fastlane sigh --development'
[12:54:56]: 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.105.2/fastlane_core/lib/fastlane_core/fastlane_folder.rb:50: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.105.2/fastlane_core/lib/fastlane_core/fastlane_folder.rb:50:in `fastfile_path'
	from /Users/falken/.fastlane/bin/bundle/lib/ruby/gems/2.2.0/gems/fastlane-2.105.2/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.105.2/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.105.2/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>'
ERROR: Job failed: exit status 1

I'll update to 2.107.0 now and report back if it happens again.

@ronocod
Copy link

ronocod commented Oct 23, 2018

Seeing this happen intermittently on multiple recent versions, including 2.107.0.

@eriadam
Copy link

eriadam commented Oct 25, 2018

For us this is now happening on a daily bases with 2.107.0.

@janpio
Copy link
Member

janpio commented Nov 14, 2018

Another occurence with 2.108.0 on Azure Devops Pipelines (CI): #13680

@janpio
Copy link
Member

janpio commented Nov 14, 2018

Here someone investigated a bit what is going on: #13586 (comment)
Seems self.path is randomly mutating?!

@mathaeus

This comment has been minimized.

@janpio
Copy link
Member

janpio commented Dec 14, 2018

I looked into the code being executed in those threads a bit. There is indeed some code that does Dir.chdir(File.expand_path('..', path)) do in there. Could something like this be the culprit @jaydorsey for what we are seeing?

@janpio
Copy link
Member

janpio commented Dec 14, 2018

For documentation:

def self.send_launch_analytic_events_for(gem_name)
return if FastlaneCore::Env.truthy?("FASTLANE_OPT_OUT_USAGE")
ci = Helper.ci?.to_s
app_id_guesser = FastlaneCore::AppIdentifierGuesser.new(args: ARGV, gem_name: gem_name)
project_hash = app_id_guesser.p_hash
p_hash = project_hash if project_hash
platform = @platform if @platform # this has to be called after `p_hash`
send_launch_analytic_events(p_hash, gem_name, platform, ci)
end

def initialize(args: nil, gem_name: 'fastlane')
@args = args
@gem_name = gem_name
@app_id = android_app_identifier(args, gem_name)
@platform = nil # since have a state in-between runs
if @app_id
@platform = :android
else
@app_id = ios_app_identifier(args)
@platform = :ios if @app_id
end
@p_hash = generate_p_hash(@app_id)
end

if you follow the methods called in here you finally end up at:
def initialize(path = nil)
if path
raise "Could not find Appfile at path '#{path}'".red unless File.exist?(File.expand_path(path))
end
path ||= self.class.default_path
if path && File.exist?(path) # it might not exist, we still want to use the default values
full_path = File.expand_path(path)
Dir.chdir(File.expand_path('..', path)) do
content = File.read(full_path, encoding: "utf-8")
# From https://github.com/orta/danger/blob/master/lib/danger/danger_core/dangerfile.rb
if content.tr!('“”‘’‛', %(""'''))
puts("Your #{File.basename(path)} has had smart quotes sanitised. " \
'To avoid issues in the future, you should not use ' \
'TextEdit for editing it. If you are not using TextEdit, ' \
'you should turn off smart quotes in your editor of choice.'.red)
end
# rubocop:disable Security/Eval
eval(content)
# rubocop:enable Security/Eval
print_debug_information(path: full_path) if FastlaneCore::Globals.verbose?
end
end
fallback_to_default_values
end

This is method that tries to get the Android or iOS package name from the Appfile.

@janpio
Copy link
Member

janpio commented Dec 14, 2018

Question to everyone here who had this problem: Can you confirm that you have an Appfile in your project?


Update: I could recreate it locally when creating an Appfile! Seems we are on track...

@dloic
Copy link

dloic commented Dec 14, 2018

Yes we do have Appfile

@dloic
Copy link

dloic commented Dec 14, 2018

Could it be related to a race condition with Dir.chdir(File.expand_path('..', path)) line 34 in appfile_config.rb?

@janpio
Copy link
Member

janpio commented Dec 14, 2018

Yep, that's exactly what I am thinking right now. Dir.chdir is not thread safe, so this could theoretically mess with the working directory in unexpected ways. I am currently trying to find a better repro now that I have that information, but can't :/

@chnbr
Copy link

chnbr commented Dec 14, 2018

I also have an app file (getting the error every start)

@mathaeus
Copy link

I don't have an Appfile but I still get the error as described in #13512.

✅ fastlane environment ✅

Stack

Key Value
OS 10.14.1
Ruby 2.5.1
Bundler? true
Git git version 2.17.1
Installation Source ~/Development/iOS/willhabeniOS/vendor/bundle/ruby/2.5.0/bin/fastlane
Host Mac OS X 10.14.1 (18B75)
Ruby Lib Dir /usr/local/Cellar/ruby/2.5.1/lib
OpenSSL Version OpenSSL 1.0.2o 27 Mar 2018
Is contained false
Is homebrew false
Is installed via Fabric.app false
Xcode Path /Applications/Xcode.app/Contents/Developer/
Xcode Version 10.1

System Locale

Variable Value
LANG en_US.UTF-8
LC_ALL en_US.UTF-8
LANGUAGE

fastlane files:

No Fastfile found

No Appfile found

fastlane gems

Gem Version Update-Status
fastlane 2.111.0 ✅ Up-To-Date

Loaded fastlane plugins:

No plugins Loaded

Loaded gems
Gem Version
did_you_mean 1.2.0
bundler 1.16.3
CFPropertyList 2.3.6
concurrent-ruby 1.1.3
i18n 1.2.0
minitest 5.11.3
thread_safe 0.3.6
tzinfo 1.2.5
activesupport 5.2.2
public_suffix 2.0.5
addressable 2.5.2
atomos 0.1.3
babosa 1.0.2
claide 1.0.2
clamp 0.6.5
colored 1.2
colored2 3.1.2
highline 1.7.10
commander-fastlane 4.4.6
declarative 0.0.10
declarative-option 0.1.0
digest-crc 0.4.1
unf_ext 0.0.7.5
unf 0.1.4
domain_name 0.5.20180417
dotenv 2.5.0
emoji_regex 0.1.1
excon 0.62.0
multipart-post 2.0.0
faraday 0.15.4
http-cookie 1.0.3
faraday-cookie_jar 0.0.6
faraday_middleware 0.12.2
fastimage 2.1.5
gh_inspector 1.1.3
jwt 2.1.0
memoist 0.16.0
multi_json 1.13.1
os 1.0.0
signet 0.11.0
googleauth 0.6.7
httpclient 2.8.3
mime-types-data 3.2018.0812
mime-types 3.2.2
uber 0.1.0
representable 3.0.4
retriable 3.1.2
google-api-client 0.23.9
google-cloud-env 1.0.5
google-cloud-core 1.2.7
google-cloud-storage 1.15.0
json 2.1.0
mini_magick 4.5.1
multi_xml 0.6.0
plist 3.4.0
rubyzip 1.2.2
security 0.1.3
naturally 2.2.0
simctl 1.6.5
slack-notifier 2.3.2
terminal-notifier 1.8.0
unicode-display_width 1.4.0
terminal-table 1.8.0
tty-screen 0.6.5
tty-cursor 0.6.0
tty-spinner 0.9.0
word_wrap 1.0.0
nanaimo 0.2.6
xcodeproj 1.7.0
rouge 2.0.7
xcpretty 0.3.0
xcpretty-travis-formatter 1.0.0
mini_portile2 2.3.0
nokogiri 1.8.5
slather 2.4.6

generated on: 2018-12-15

@janpio
Copy link
Member

janpio commented Dec 14, 2018

Thanks @chnbr.
Thanks @mathaeus, that fits as well: Your fastlane crashes a lot later, where there can already be a lot of other code being executed that spawns threads that can interfere by changing the working directory. If my current understanding turns out to be right regarding the "crashes directly after startup" situation, we will have to investigate #13512 under these aspects again. I am pretty sure there is something else going on.

@mathaeus
Copy link

Thanks @janpio for the quick answer. The consequence in the case of #13512 is also not that tragic imo since one can continue with deliver, you just don't see the HTML preview. Which I can live with for the moment personally, but yeah, sooner or later it would be nice of course to see that fixed :)

Let us know if you need more info.

@janpio janpio self-assigned this Dec 15, 2018
@chnbr
Copy link

chnbr commented Dec 15, 2018

@mathaeus I am not sharing your considering #13512 "not that tragic". I currently have a new submission in 18 languages, completely fresh metadata and completely new screenshots. In such a case the html preview is "essential" to review if everything in every language is alright. Sure, you could do the review once it is uploaded in appstoreconnect, but this is very inconvenient, although it does work of course.

@janpio
Copy link
Member

janpio commented Dec 15, 2018

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.

@falken42
Copy link
Author

@janpio: Great to hear, thanks for the fix!

I'd just like to confirm one thing: approximately what version of fastlane started using the analytics code with the offending call to Dir.chdir on a separate thread?

Going back through our fastlane version timeline, we basically saw this:

  • 2.41.0: first fastlane version we began using (no error)
  • 2.64.1: last fastlane version that didn't exhibit this issue
  • 2.85.0: first fastlane version that did exhibit this issue

So if the analytics were added somewhere between 2.64.1 and 2.85.0, it's fairly safe to say that's indeed the problem.

@janpio
Copy link
Member

janpio commented Dec 15, 2018

That code was actually in place since May 2017, which makes this ~2.30.0+. But as it is a race condition, it is basically a timing thing. Any change in the startup process could move the two pieces that clash closer together or further apart. I also think, that the computer/processor being used influences the probability of the race condition being triggered.

@falken42
Copy link
Author

Yeah, that definitely sounds reasonable. Thanks for checking!

@marcelofabri
Copy link
Contributor

@janpio Thanks for investigating this so deeply! 💯

@dloic
Copy link

dloic commented Dec 19, 2018

I can confirm we're still able to reproduce without setting FASTLANE_SKIP_UPDATE_CHECK. Will now try with FASTLANE_OPT_OUT_USAGE=1 and let you know.

@dloic
Copy link

dloic commented Jan 7, 2019

Hi!

A quick update, I can confirm, setting FASTLANE_OPT_OUT_USAGE=1, we cannot reproduce the error ;)

@dloic
Copy link

dloic commented Jan 7, 2019

@janpio With #13918 out, does it means the issue has been completely resolved or is there any other part of the code with problematic chdir?

@janpio
Copy link
Member

janpio commented Jan 9, 2019

No, that was all that I could identify.
Please don't tell me you still have the problem?

@dloic
Copy link

dloic commented Jan 10, 2019

Ahah, 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 :)

@fastlane-bot
Copy link

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.

Please make sure to update to the latest fastlane version and check if that solves the issue. Let us know if that works for you by adding a comment 👍

@fastlane-bot
Copy link

This issue will be auto-closed because there hasn't been any activity for a few months. Feel free to open a new one if you still experience this problem 👍

@fastlane fastlane locked and limited conversation to collaborators Apr 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests