Project

General

Profile

Actions

Bug #6705

closed

[API] Websockets denial of service requesting past logs

Added by Peter Amstutz almost 9 years ago. Updated almost 9 years ago.

Status:
Resolved
Priority:
Normal
Assigned To:
Category:
-
Target version:
Story points:
0.5

Description

If a user connects to websockets and provides last_log_id = 1, websockets will replay all logs matching the filter from the beginning of time. Unfortunately, while it is doing that, it stops responding to every other interaction as well.

It sometimes crashes with a stack overflow:

/home/peter/.rvm/gems/ruby-2.1.1/bin/ruby_executable_hooks:15: stack level too deep (SystemStackError)

It's already supposed to break up sending the backlog in chunks to avoid this exact problem, so my suspicion is that EventMachine is being silly and executing push_events immediately from schedule instead of the intended behavior of queuing the task until the next turn of the event loop.

        if count == limit
          # Number of rows returned was capped by limit(), we need to schedule
          # another query to get more logs (will start from last_log_id
          # reported by current query)
          EventMachine::schedule do
            push_events ws, nil
          end

Subtasks 2 (0 open2 closed)

Task #6724: Review 6705-fix-websockets-replayResolvedRadhika Chippada07/23/2015Actions
Task #6714: FixResolvedPeter Amstutz07/23/2015Actions
Actions

Also available in: Atom PDF