The shutdown process appears to be stalled
Hi all, I have a problem with Logstash (7.2.0 version) and filebeat (7.2.0 version). I read other issues but I didnt find any solution to this problem.
I'm using a configuration: filebeat --> logstash --> stdout (all in the same machine).
The configuration works properly (so send correctly the logs from a file in a directory using filebeat, passing for logstash and printed out to the stdout).
But stopping logstash (using Ctrl+c) I receive this error:
"[ERROR][org.logstash.execution.ShutdownWatcherExt] The shutdown process appears to be stalled due to busy or blocked plugins. Check the logs for more information."
So it seems that during the logstash stop process something went wrong. After the stop (and after this error), when I try to restart logstash with the same configuration it not works. Logstash seems "stalled or blocked" because noone data is printed out in stdout. The only way to unlock logstash that i found is restart the machine :(
I realize the problem also because, for example:
When I try to start filebeat, and logstash is NOT blocked, I have this starting logs:
So correctly.
When I try to start filebeat, and logstash IS blocked, I have this starting logs:
So, filebeat is not able to establish a connection with logstash.
The command used to start logstash: bin/logstash -e 'input { beats { port => "5044" } } output { stdout { codec => rubydebug } }' I also tried to start logstash using --pipeline.unsafe_shutdown (like suggested here https://www.elastic.co/guide/en/logstash/current/shutdown.html) but nothing changed.
The command used to start filebeat: ./filebeat -e -c ActiveMQ_filebeat.yml -d "publish"
The ActiveMQ_filebeat.yml is not a particolar configuration, only send logs from a certain path to logstash.
Do you have any ideas to solve this situation? I need two things:
- a method to stop logstash properly (but suing Ctrl+c is a normal practice: https://www.elastic.co/guide/en/logstash/current/shutdown.html)
- a quick method to unlock logstash when it is blocked
Thanks a lot.
Plugins that maintain network connections or other resources may take a few seconds to shut down. The shutdown watcher keeps track of those so that's expected. From the output above, Logstash shut down just over 1 second later. I'm not sure why you can't restart Logstash, but I'd check to see if something else is listening on port 5044 using lsof or the like. If you need further assistance with this, please post in our Logstash forums.
Please don‘t close this issue, we‘re experience the same with Logstash 7.2.0 and even waiting for 10 minutes doesn‘t shutdown.
@abraxxa, that sounds like a different problem since the Logstash instance in the issue above shuts down within a couple seconds.
Same message which is why I‘ve subscribed to the issue.
I'm continuing to have the same problem. If I stop logstash (ctrl+c) and filebeat, when I simply start again both components (logstash and filebeat), sometime filebeat is not able to establish a connection with logstash. The strange thing is that I don't change any configuration before to start again them.
I'm facing same issue in 7.1.1. I have to forcefully kill the process.
For folks landing here, the pipeline and the beats input have had multiple fixes since July 5th. please update to the most recent version of Logstash and if the issue still shows up create a new issue with logs, otherwise it's hard to tell if this is all related to the same problem or not.
Still occurring with 7.15, seems to be caused when logstash is unable to forward the log messages to the output stream (in my case elasticsearch instead of stdout, and elasticsearch is returning a 403). During this stalled period, with xpack management enabled, a change to the configuration used by logstash does not get applied.
The error on the ES write returns:
"reason"=>"action [indices:data/write/index:op_type/index] is unauthorized for user
And logstash sits there spamming these:
[2021-10-12T02:07:06,477][WARN ][org.logstash.execution.ShutdownWatcherExt] {"inflight_count"=>0, "stalling_threads_info"=>{["LogStash::Filters::GeoIP", {"default_database_type"=>"ASN", "id"=>"geoip_source_ip", "source"=>"[source][ip]", "ecs_compatibility"=>"v1"}]=>[{"thread_id"=>41, "name"=>"[staging-beats]>worker0", "current_call"=>"[...]/vendor/bundle/jruby/2.5.0/gems/stud-0.0.23/lib/stud/interval.rb:89:in `sleep'"}]}}
[2021-10-12T02:07:06,479][ERROR][org.logstash.execution.ShutdownWatcherExt] The shutdown process appears to be stalled due to busy or blocked plugins. Check the logs for more information.
The GeoIP filter line is the last in the filters config and looks like
if [source][ip] {
geoip {
id => "geoip_source_ip"
default_database_type => "ASN"
ecs_compatibility => "v1"
source => "[source][ip]"
}
}
Would be cool to know what went wrong where in what plugin.
[2022-06-18T02:40:52,003][ERROR][org.logstash.execution.ShutdownWatcherExt] The shutdown process appears to be stalled due to busy or blocked plugins. Check the logs for more information.
2022-06-18T14:25:13,370][ERROR][logstash.outputs.elasticsearch][main][f3735405c6e09f36684b8865a1ae20eedcec96f621461ff0166584be9e2ff9d8] Encountered a retryable error (will retry with exponential backoff) {:code=>401, :url=>"http://localhost:9200/_bulk", :content_length=>5546}
@Koesters the log message that is after the one remaining in your edited comment indicates that an Elasticsearch output plugin is in a retry loop trying to push a batch of events into Elasticsearch but is receiving 401 http responses. The pipeline cannot safely shut down while it has one or more batches of events in this state because doing so would cause the events to be lost.
@Koesters the log message that is after the one remaining in your edited comment indicates that an Elasticsearch output plugin is in a retry loop trying to push a batch of events into Elasticsearch but is receiving 401 http responses. The pipeline cannot safely shut down while it has one or more batches of events in this state because doing so would cause the events to be lost.
I am new to ES.
this is a twitter keyword filtered stream on logstash. It runs for hours OK, then it stalls and I have no idea why. The ES on Kibana is always up.
[2022-06-18T15:02:58,003][ERROR][logstash.outputs.elasticsearch][main][f3735405c6e09f36684b8865a1ae20eedcec96f621461ff0166584be9e2ff9d8] Attempted to send a bulk request but Elasticsearch appears to be unreachable or down {:message=>"Elasticsearch Unreachable: [http://localhost:9200/_bulk][Manticore::SocketException] Connect to localhost:9200 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused (Connection refused)", :exception=>LogStash::Outputs::ElasticSearch::HttpClient::Pool::HostUnreachableError, :will_retry_in_seconds=>64}
someone@TonyBeets:/var/log/logstash# telnet 127.0.0.1 9200
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
GET /_bulk
HTTP/1.0 400 Bad Request
X-elastic-product: Elasticsearch
content-type: application/json;charset=utf-8
content-length: 203
{"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"text is empty (possibly HTTP/0.9)"}],"type":"illegal_argument_exception","reason":"text is empty (possibly HTTP/0.9)"},"status":400}Connection closed by foreign host.
someone@TonyBeets:/var/log/logstash# telnet 127.0.0.1 9200
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
POST /_bulk
HTTP/1.0 400 Bad Request
X-elastic-product: Elasticsearch
content-type: application/json;charset=utf-8
content-length: 203
{"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"text is empty (possibly HTTP/0.9)"}],"type":"illegal_argument_exception","reason":"text is empty (possibly HTTP/0.9)"},"status":400}Connection closed by foreign host.`
The conf is below (obviously the Twitter keys been filled out). First I was changing the index daily and thought it was this ( index => "stream-searchterm_tweets-%{+dd-MM-YYYY}"), then the csv or the stream to stdout, but now it seems a general set up problem. 😔😟☹️
input {
twitter {
consumer_key => ''
consumer_secret => ''
oauth_token => ''
oauth_token_secret => '2'
full_tweet => "true"
ignore_retweets => "true"
keywords => [ 'searchterm1','searchterm2']
}
}
output {
elasticsearch {
hosts => ["http://localhost:9200"]
#data_stream => "true"
#data_stream_type => "metrics"
#http_compression => "false"
index => "stream-searchterm_tweets"
}
#stdout {
#}
#csv {
# csv_options => {
# "col_sep" => ","
# #"row_sep" => "\r\n"
# }
# fields => [text,truncated,quote_count,source,retweet_count,filter_level,timestamp_ms,coordinates,geo,in_reply_to_status_id_str,in_reply_to_screen_name,created_at,lang,in_reply_to_user_id,retweeted,in_reply_to_status_id,is_quote_status,user,favorite_count,reply_count,id,possibly_sensitive,display_text_range,entities,in_reply_to_user_id_str,id_str,extended_tweet,entities,user_mentions,media,symbols,extended_entities,full_text,favorited,place]
# path => "/root/stream-searchterm-%{+dd-MM-YYYY}.csv"
#
#}
}
The error you are getting when attempting to telnet into Elasticsearch is because Elasticsearch is expecting an HTTP request, not a telnet request (you may be better off using curl).
An HTTP 401 being experienced by your pipeline is likely authentication related:
The HyperText Transfer Protocol (HTTP) 401 Unauthorized response status code indicates that the client request has not been completed because it lacks valid authentication credentials for the requested resource. HTTP 401 Unauthorized
A closed issue is not really the place to debug this. Would you mind opening up a thread in our discussion forum?