Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Aleksei Pilnik
@apilnik
@Fryguy okay, I will let you know when finish translation
Jason Frey
@Fryguy
cc @chessbyte ^
Joe Rafaniello
@jrafanie
@agrare @Fryguy I have it working with dalli 3.1.0. I'm not too happy that you have to cast the session_id to string though
diff --git a/app/models/user.rb b/app/models/user.rb
index 5a0885121a..0548132b66 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -233,7 +233,7 @@ class User < ApplicationRecord
     return unless request
     return unless (session_id = request.session_options[:id])

-    sessions << Session.find_or_create_by(:session_id => session_id)
+    sessions << Session.find_or_create_by(:session_id => session_id.to_s)
   end

   def broadcast_revoke_sessions
diff --git a/lib/extensions/rack_session_dalli_patch.rb b/lib/extensions/rack_session_dalli_patch.rb
index 4c4ec35d34..317b684811 100644
--- a/lib/extensions/rack_session_dalli_patch.rb
+++ b/lib/extensions/rack_session_dalli_patch.rb
@@ -4,7 +4,7 @@ require "rack/session/dalli"
 module RackSessionDalliPatch
   def delete_sessions(session_ids)
     session_ids.each do |session_id|
-      destroy_session(ManageIQ::Session.fake_request.env, session_id, :drop => true)
+      delete_session(ManageIQ::Session.fake_request.env, session_id, :drop => true)
     end
   end

@@ -12,7 +12,7 @@ module RackSessionDalliPatch
   # cause a load to occur. Consequently, we need to manage things
   # carefully to prevent a deadlock between the Rails Interlock and
   # Dalli's own exclusive lock.
-  def with_block(*args)
+  def with_dalli_client(*args)
     ActiveSupport::Dependencies.interlock.permit_concurrent_loads do
       super do |dc|
         ActiveSupport::Dependencies.interlock.running do
@@ -27,7 +27,7 @@ end
 # with_lock was renamed to with_block with a slightly different interface.
 # All versions since 2.7.7 have with_block now.
 # Additionally, we'll detect and warn if the method we depend on in our prepended module doesn't exist before we try to prepend it.
-%w[with_block destroy_session].each do |method|
+%w[with_dalli_client delete_session].each do |method|
   begin
     Rack::Session::Dalli.instance_method(method)
   rescue NameError => err
Joe Rafaniello
@jrafanie
Oh great, some pages are hung. It's fun dealing with upgrades of gems with our monkey patches for deadlock avoidance. :eyes:
I'll just lock dalli for now. I'm not sure how long this will take
Joe Rafaniello
@jrafanie
Jason Frey
@Fryguy
I'm marking that morphy/yes?
IMO, we will hit the same issues on morphy, and since we are actively trying to lock it down, we might as well backport this. cc @bdunne
Brandon Dunne
@bdunne
yeah, I think that needs to be morphy/yes
Joe Rafaniello
@jrafanie
Thanks, agreed
Joe Rafaniello
@jrafanie
I swear... I've got dalli 3.1.0 running with my changes to make our existing patches work with 3.1.0 but it hangs on some pages. I stop and add the rails debug locks middleware so I can see where it's deadlocking and guess what happens... it doesn't hang
Jason Frey
@Fryguy
:neutral_face:
Joe Rafaniello
@jrafanie
heisenbug!
zackary-deems
@zackary-deems
I attempt to list our configured alerts (we have >200) and it renders properly at 20 items. If I change it to show ALL of them... the UI just sits there with the spinner icon and never comes back. When I poke around in the logs, I find this in the apache error log:
[Wed Dec 08 10:40:37.127971 2021] [proxy_http:error] [pid 201586:tid 140171787233024] [client ...:56674] AH01114: HTTP: failed to make connection to backend: 0.0.0.0, referer: https://.../miq_alert/show_list
[Wed Dec 08 10:40:37.129286 2021] [proxy:error] [pid 201586:tid 140171787233024] (111)Connection refused: AH00957: HTTP: attempt to connect to 0.0.0.0:4004 (0.0.0.0) failed
Jason Frey
@Fryguy
nice!
do you see anyhting in the postgresql logs?
zackary-deems
@zackary-deems
hmm
Jason Frey
@Fryguy
also, if you can enable debug mode for the logs, then we can see the individual queries....high chance it's an N+1 issue
zackary-deems
@zackary-deems
See, now you have me poking around in other logs, and I see things like this that SOUND bad..
2021-12-08 10:40:37 EST:100.66.3.19(41762):61b0d1f5.da09:[unknown]@[unknown]:[55817]:FATAL: unsupported frontend protocol 1234.5680: server supports 2.0 to 3.0
That's about the only notable entry from the /var/lib/pgsql/data/log/postgresql.log from that time period.
debug mode for... postgres?
Jason Frey
@Fryguy
debug mode for manageiq logs
in the advanced settings change log_rails (I think?) to debug
zackary-deems
@zackary-deems
AH ok.
zackary-deems
@zackary-deems
so I'll be looking for the output of that change in evm/production log?
This looks interesting
Jason Frey
@Fryguy
production log
that will have the entire request from the UI point of view including the database queries
zackary-deems
@zackary-deems
evm.log:[----] W, [2021-12-08T11:35:25.324314 #200866:2ad76874fa08] WARN -- : security warning, CSP violation report follows: {"csp-report"=>{"blocked-uri"=>"https://fonts.gstatic.com/s/ibmplexsans/v6/zYX7KVElMYYaJe8bpLHnCwDKhdTmyIJcdvfo.woff", "document-uri"=>"https://hostname/ops/explorer", "original-policy"=>"default-src 'self'; child-src 'self'; connect-src 'self' wss://hostname; script-src 'unsafe-eval' 'unsafe-inline' 'self'; style-src 'unsafe-inline' 'self'; report-uri https://hostname/dashboard/csp_report", "referrer"=>"https://hostname/miq_alert/show_list", "violated-directive"=>"default-src"}}
Jason Frey
@Fryguy
that's ultimately fine, since it's a font that we use, but I am surprisd it gives a CSP violation, since I thought google fonts was in our whitelist
cc @kavyanekkalapu ^
which version is this?
zackary-deems
@zackary-deems
[----] D, [2021-12-08T11:34:56.048713 #200877:2b1d1da81e24] DEBUG -- : (0.4ms) SELECT COUNT(*) FROM (SELECT DISTINCT "miq_alerts"."id" FROM "miq_alerts") subquery_for_count
[----] D, [2021-12-08T11:34:56.051304 #200877:2b1d1da81e24] DEBUG -- : SQL (2.1ms) SELECT "miq_alerts"."id" AS t0_r0, "miq_alerts"."guid" AS t0_r1, "miq_alerts"."description" AS t0_r2, "miq_alerts"."created_on" AS t0_r3, "miq_alerts"."updated_on" AS t0_r4, "miq_alerts"."options" AS t0_r5, "miq_alerts"."db" AS t0_r6, "miq_alerts"."miq_expression" AS t0_r7, "miq_alerts"."responds_to_events" AS t0_r8, "miq_alerts"."enabled" AS t0_r9, "miq_alerts"."read_only" AS t0_r10, "miq_alerts"."hash_expression" AS t0_r11, "miq_alerts"."severity" AS t0_r12 FROM "miq_alerts" ORDER BY LOWER("miq_alerts"."description") ASC LIMIT $1 OFFSET $2 [["LIMIT", 500], ["OFFSET", 0]]
[----] D, [2021-12-08T11:34:56.055946 #200877:2b1d1da81e24] DEBUG -- : MiqAlert Inst Including Associations (4.0ms - 213rows)
/var/www/miq/vmdb/app/models/miq_alert.rb:73:in `evaluation_description'
zackary-deems
@zackary-deems
THIS one works fine:
[----] D, [2021-12-08T11:34:47.037543 #200877:2b1d1da81d0c] DEBUG -- : (1.8ms) SELECT COUNT(*) FROM (SELECT DISTINCT "miq_alerts"."id" FROM "miq_alerts") subquery_for_count
[----] D, [2021-12-08T11:34:47.039330 #200877:2b1d1da81d0c] DEBUG -- : SQL (1.1ms) SELECT "miq_alerts"."id" AS t0_r0, "miq_alerts"."guid" AS t0_r1, "miq_alerts"."description" AS t0_r2, "miq_alerts"."created_on" AS t0_r3, "miq_alerts"."updated_on" AS t0_r4, "miq_alerts"."options" AS t0_r5, "miq_alerts"."db" AS t0_r6, "miq_alerts"."miq_expression" AS t0_r7, "miq_alerts"."responds_to_events" AS t0_r8, "miq_alerts"."enabled" AS t0_r9, "miq_alerts"."read_only" AS t0_r10, "miq_alerts"."hash_expression" AS t0_r11, "miq_alerts"."severity" AS t0_r12 FROM "miq_alerts" ORDER BY LOWER("miq_alerts"."description") ASC LIMIT $1 OFFSET $2 [["LIMIT", 20], ["OFFSET", 0]]
[----] D, [2021-12-08T11:34:47.059271 #200877:2b1d1da81d0c] DEBUG -- : MiqAlert Inst Including Associations (19.6ms - 20rows)
Jason Frey
@Fryguy
is this an error? /var/www/miq/vmdb/app/models/miq_alert.rb:73:in 'evaluation_description'
zackary-deems
@zackary-deems
Hey neat.. there IS an error
Jason Frey
@Fryguy
can you maybe gist the entire request? (starts with a Processing by line and then ends with a Completed <return code> line)
zackary-deems
@zackary-deems
er... not sure I caught all of it, but I think I did
yeah, I think I caught it all
Jason Frey
@Fryguy
VimString! @agare :P
@zackary-deems which version of MIQ?
zackary-deems
@zackary-deems
Lasker ... Infrastructure Management
Jason Frey
@Fryguy
the CSP violation was fixed in lasker
hmmm
Completed 200 OK is weird too