File tree Expand file tree Collapse file tree 2 files changed +15
-7
lines changed
rb/lib/selenium/webdriver Expand file tree Collapse file tree 2 files changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -170,9 +170,12 @@ def callback_thread(params)
170170 rescue Error ::WebDriverError , *CONNECTION_ERRORS => e
171171 WebDriver . logger . debug "Callback aborted: #{ e . class } : #{ e . message } " , id : :ws
172172 rescue StandardError => e
173- # Unexpected handler failure; log with a short backtrace.
173+ # Do not allow an error raised during bidi interception to prevent potential deadlock
174+ Thread . main . raise ( e ) unless @closing || params [ 'isBlocked' ]
175+
176+ condition = @closing ? 'on closing' : 'during interception'
174177 bt = Array ( e . backtrace ) . first ( 5 ) . join ( "\n " )
175- WebDriver . logger . error "Callback error: #{ e . class } : #{ e . message } \n #{ bt } " , id : :ws
178+ WebDriver . logger . error "Callback error #{ condition } : #{ e . class } : #{ e . message } \n #{ bt } " , id : :ws
176179 end
177180 end
178181
Original file line number Diff line number Diff line change @@ -209,13 +209,18 @@ def switch_to_default_content
209209 QUIT_ERRORS = [ IOError , EOFError , WebSocket ::Error ] . freeze
210210
211211 def quit
212- execute :delete_session
213- ensure
214212 begin
215- http . close
216- rescue *QUIT_ERRORS
217- nil
213+ execute :delete_session
214+ rescue *QUIT_ERRORS => e
215+ WebDriver . logger . debug "delete_session failed during quit: #{ e . class } : #{ e . message } " , id : :ws
216+ ensure
217+ begin
218+ http . close
219+ rescue *QUIT_ERRORS => e
220+ WebDriver . logger . debug "http.close failed during quit: #{ e . class } : #{ e &.message } " , id : :ws
221+ end
218222 end
223+ nil
219224 end
220225
221226 def close
You can’t perform that action at this time.
0 commit comments