elastic / logstash

Logstash - transport and process your logs, events, or other data
https://www.elastic.co/products/logstash
Other
75 stars 3.5k forks source link

Unable to install Rubygem atomic dependency of (unknown?) Logstash plugin #9194

Closed ageis closed 4 years ago

ageis commented 6 years ago

Elastic.co moves fast, and migrations and updates are one of the deficiencies of the stack. I have to update my Logstash plugins manually rather than it being done within a hook of the Debian package. So with the 6.2.2 update, as root, I cd'd to /usr/share/logstash/bin and ran ./logstash update.

My error was

Error Bundler::InstallError, retrying 1/10
An error occurred while installing atomic (1.1.100), and Bundler cannot continue.
Make sure that `gem install atomic -v '1.1.100'` succeeds before bundling.

I tried to get into the correct environment for me to run the embedded gem program and upgrade that gem, so I ran source logstash.lib.sh

# source logstash.lib.sh
dirname: invalid option -- 'b'
Try 'dirname --help' for more information.

So there's two bugs here.

ageis commented 6 years ago

Okay, that script that doesn't run under POSIX sh, but does under Bash. Still, how do I source the PATH to get the gem command?

jordansissel commented 6 years ago

The error message you get is misleading. Running the “gem” command yourself won’t fix this issue.

Can you paste the full output in this issue?

On Sun, Feb 25, 2018 at 1:18 PM Kevin M. Gallagher notifications@github.com wrote:

Okay, that's script that doesn't run under POSIX sh, but does under Bash. Still, how do I source the PATH to get the gem command?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/elastic/logstash/issues/9194#issuecomment-368345540, or mute the thread https://github.com/notifications/unsubscribe-auth/AAIC6gSNCuMesVrYwvYZxnKjrmVmW-1Oks5tYc4lgaJpZM4SSdmb .

ageis commented 6 years ago
root@stats:/usr/share/logstash/bin# ./logstash-plugin update
Updating logstash-codec-cef, logstash-codec-collectd, logstash-codec-dots, logstash-codec-edn, logstash-codec-edn_lines, logstash-codec-es_bulk, logstash-codec-fluent, logstash-codec-graphite, logstash-codec-json, logstash-codec-json_lines, logstash-codec-line, logstash-codec-msgpack, logstash-codec-multiline, logstash-codec-netflow, logstash-codec-plain, logstash-codec-rubydebug, logstash-filter-aggregate, logstash-filter-anonymize, logstash-filter-cidr, logstash-filter-clone, logstash-filter-csv, logstash-filter-date, logstash-filter-de_dot, logstash-filter-dissect, logstash-filter-dns, logstash-filter-drop, logstash-filter-elasticsearch, logstash-filter-fingerprint, logstash-filter-geoip, logstash-filter-grok, logstash-filter-jdbc_static, logstash-filter-jdbc_streaming, logstash-filter-json, logstash-filter-kv, logstash-filter-metrics, logstash-filter-mutate, logstash-filter-ruby, logstash-filter-sleep, logstash-filter-split, logstash-filter-syslog_pri, logstash-filter-throttle, logstash-filter-translate, logstash-filter-truncate, logstash-filter-urldecode, logstash-filter-useragent, logstash-filter-xml, logstash-input-beats, logstash-input-dead_letter_queue, logstash-input-elasticsearch, logstash-input-exec, logstash-input-file, logstash-input-ganglia, logstash-input-gelf, logstash-input-generator, logstash-input-graphite, logstash-input-heartbeat, logstash-input-http, logstash-input-http_poller, logstash-input-imap, logstash-input-jdbc, logstash-input-kafka, logstash-input-pipe, logstash-input-rabbitmq, logstash-input-redis, logstash-input-s3, logstash-input-snmptrap, logstash-input-sqs, logstash-input-stdin, logstash-input-syslog, logstash-input-tcp, logstash-input-twitter, logstash-input-udp, logstash-input-unix, logstash-output-cloudwatch, logstash-output-csv, logstash-output-elasticsearch, logstash-output-email, logstash-output-file, logstash-output-graphite, logstash-output-http, logstash-output-kafka, logstash-output-lumberjack, logstash-output-nagios, logstash-output-null, logstash-output-pagerduty, logstash-output-pipe, logstash-output-rabbitmq, logstash-output-redis, logstash-output-s3, logstash-output-sns, logstash-output-sqs, logstash-output-stdout, logstash-output-tcp, logstash-output-udp, logstash-output-webhdfs
Error Bundler::InstallError, retrying 1/10
An error occurred while installing atomic (1.1.100), and Bundler cannot continue.
Make sure that `gem install atomic -v '1.1.100'` succeeds before bundling.
Error Bundler::InstallError, retrying 2/10
An error occurred while installing atomic (1.1.100), and Bundler cannot continue.
Make sure that `gem install atomic -v '1.1.100'` succeeds before bundling.

That keeps going in a loop. Should I be doing this as Logstash's user instead of root? Are there any verbose flags to logstash-plugin?

jordansissel commented 6 years ago

It will stop trying after 10 times and will report a longer message after that.

ageis commented 6 years ago

Not much more info...

Too many retries, aborting, caused by Bundler::InstallError
ERROR: Updated Aborted, message: An error occurred while installing atomic (1.1.100), and Bundler cannot continue.
Make sure that `gem install atomic -v '1.1.100'` succeeds before bundling.
jordansissel commented 6 years ago

migrations and updates are one of the deficiencies of the stack.

I don't have enough information on this to provide any kind of response.

I have to update my Logstash plugins manually rather than it being done within a hook of the Debian package

I'm not understanding. What is your expectation of the package? Are you expecting bin/logstash-plugin update to run automatically after installing the package? Or something else?

jordansissel commented 6 years ago

Stepping back, what problem are you encountering that you want to solve with bin/logstash-plugin update ?

ageis commented 6 years ago

@jordansissel In previous versions I've had problems where my custom-installed (non-default) plugins caused the systemd service to fail until those were updated and re-installed. It looks like that's not happening or the case anymore and the service is running as normal. If you like you can close this while making a note of the bundle problem. See the related issue I filed about that: https://github.com/elastic/logstash/issues/7040

jordansissel commented 6 years ago

ok cool, thanks for the extra details :)

ageis commented 6 years ago

Also, as another example of this pattern, options that used to be in elasticsearch.yml now need to be CURL-posted.

jordansissel commented 6 years ago

Actually I'll leave this open since bin/logstash-plugin update should probably not fail out of the box..

cc @jsvd for further investigating

arenard commented 6 years ago

I encounter the same error message as @ageis when I run bin/logstash-plugin update on a fresh logstash 5.6.8 install directory.

The issue may be related to the release 1.1.100 of atomic gem. This gem remains untouched since january 2015 (last version being 1.1.99-java) but it was updated on 25 january with 1.1.100 release (see https://rubygems.org/gems/atomic).

As a quick and dirty fix I added a dependency to 1.1.99 atomic gem in logstash Gemfile as a temporary workaround for now.

mahsoud commented 6 years ago

reproduced it on windows, and tracked it down to

logstash-plugin.bat update logstash-filter-metrics, logstash-filter-throttle

jakelandis commented 6 years ago

I ran into this too (creating an zip from source). The error is

/Users/jake/.rvm/rubies/jruby-1.7.27/bin/jruby -r ./siteconf20180227-3053-bi0jx6.rb extconf.rb
NotImplementedError: C extension support is not enabled. Pass -Xcext.enabled=true to JRuby or set JRUBY_OPTS.

   (root) at /Users/jake/.rvm/rubies/jruby-1.7.27/lib/ruby/shared/mkmf.rb:8
  require at org/jruby/RubyKernel.java:1040
   (root) at /Users/jake/.rvm/rubies/jruby-1.7.27/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:1
   (root) at extconf.rb:13

extconf failed, uncaught signal 1

as @arenard mentions this gem hasn't seen any real changes for a couple years, but had a recent release that suspiciously changes the size of the gem.

The fix here is to pin the atomic gem gem "atomic", "<= 1.1.99"

I will work on getting this defaulted in the next release.

arenard commented 6 years ago

That is the fix I applied too. Are we sure about usability of gem versions older than 1.1.99 and if not why not pinning it exactly to 1.1.99 version using = comparator instead of <= ?

Atomic 1.1.100 gem size is about the same size as 1.1.99 but is significantly different than 1.1.99-java variant which is actually used in logstash. But there is no -java variant for 1.1.100. According to atomic gemspec file I would suspect that -java variant is required with JRUBY:

if defined?(JRUBY_VERSION)
    s.files = Dir['lib/atomic_reference.jar']
    s.platform = 'java'
else
    s.extensions = 'ext/extconf.rb'
end

Another anoying fact is that 1.1.100 release is not present in the repository releases (see https://github.com/ruby-concurrency/atomic/releases). The repository seems to be deprecated in favor of https://github.com/ruby-concurrency/concurrent-ruby with a -java gem used in logstash too and covering same basic needs.

trenerok commented 6 years ago

i have the same problem

pemontto commented 6 years ago

Same problem on Centos7, Logstash 6.1.3, 6.2.1 and 6.2.2 and fresh installs. Can't currently update plugins and it's killing my deploy scripts 🙁

tomsommer commented 6 years ago

Same problem on CentOS 6 (obviously)

jordansissel commented 6 years ago

I think @jake.landis is working on this

On Sun, Mar 4, 2018 at 11:16 PM Tom Sommer notifications@github.com wrote:

Same problem on CentOS 6 (obviously)

— You are receiving this because you modified the open/close state.

Reply to this email directly, view it on GitHub https://github.com/elastic/logstash/issues/9194#issuecomment-370329754, or mute the thread https://github.com/notifications/unsubscribe-auth/AAIC6t3v1Kn2gGs49Z9lhxgiSF_KNgx1ks5tbOZCgaJpZM4SSdmb .

jakelandis commented 6 years ago

The atomic gem is now pinned to a working version for new (not yet released) releases on 5.x and 6.x. However, for existing releases, this requires manual pinning 1.1.99 . I have logged an issue to the atomic gem https://github.com/ruby-concurrency/atomic/issues/7 to address from their end (which if fixed will un-break existing installs without needing to manually pin versions)

dwasss commented 6 years ago

What are the instructions for the workaround?

pemontto commented 6 years ago

@dwasss add this line to the end of your /usr/share/logstash/Gemfile file

gem "atomic", "<= 1.1.99"
kares commented 4 years ago

this problem was previously addressed (by concurrent-ruby team) by yanking atomic 1.1.100 and releasing 1.1.101