I've an error when Sidekiq trying to process a Rails Job.I'm now migrating the web app to google cloud service where i set up a redis server and the broker mqtt.
The Active Job is the following:
def publish_updatetopic = "tournament_team_category/#{@round_match.round.tournament_team_category.id}"payload = { round_match: { id: @round_match.id, started_at: @round_match.started_at, ended_at: @round_match.ended_at, first_round_match_team: { id: @round_match.first_round_match_team.id, goals: @round_match.first_round_match_team.goals }, second_round_match_team: { id: @round_match.second_round_match_team.id, goals: @round_match.second_round_match_team.goals } }}# TODO: Improve exception managebegin MQTT_CLIENT.connect MQTT_CLIENT.publish(topic, payload.to_json, false, 1) MQTT_CLIENT.disconnectrescue MQTT::NotConnectedException => _e return nilrescue MQTT::ProtocolException => _e return nilendend
When Sidekiq try to execute this job the server show me this error:
2020-10-01 13:22:39 worker[20201001t140958] 2020-10-01T13:22:39.897Z 1 TID-gtixo1hip WARN: Errno::EPIPE: Broken pipe2020-10-01 13:22:39 worker[20201001t140958] 2020-10-01T13:22:39.897Z 1 TID-gtixo1hip WARN: /app/vendor/bundle/ruby/2.6.0/gems/mqtt-0.5.0/lib/mqtt/client.rb:556:in `write'2020-10-01 13:22:39 worker[20201001t140958] /app/vendor/bundle/ruby/2.6.0/gems/mqtt-0.5.0/lib/mqtt/client.rb:556:in `block in send_packet'
The mqtt client.rb line 556 code is:
# Send a packet to server def send_packet(data)# Raise exception if we aren't connected raise MQTT::NotConnectedException if not connected?# Only allow one thread to write to socket at a time @write_semaphore.synchronize do @socket.write(data.to_s) endend
I can't find any solution to fix this and my jobs still in stuck.Anyone ever had this kind of problem?
Thanks