Skip to content

Handling RuntimeError from Storage Controller in OpenWPM #1079

@MohammadMahdiJavid

Description

@MohammadMahdiJavid

Hi,

I am encountering a specific RuntimeError when using OpenWPM and I am seeking advice on the correct approach to handle it. The error occurs as follows:

  File "demo.py", line 470, in <module>
    manager.execute_command_sequence(command_sequence)
    
  File "openwpm/task_manager.py", line 435, in execute_command_sequence
    agg_queue_size = self.storage_controller_handle.get_most_recent_status()
    
  File "storage/storage_controller.py", line 625, in get_most_recent_status
    raise RuntimeError(
    
RuntimeError: No status update from the storage controller process for 4859 seconds.

I attempted to handle this exception with a try-except block, but it doesn't seem to be effective:

for command_sequence in command_sequences : 
  try :
      manager.execute_command_sequence(command_sequence)
  except : 
      continue

I would appreciate any guidance on the correct way to handle this exception. Is there a specific approach or pattern recommended for handling such timeouts or lack of status updates in OpenWPM? Any insights or suggestions would be greatly appreciated.

Thank you.

def execute_command_sequence(
self, command_sequence: CommandSequence, index: Optional[int] = None
) -> None:
"""
parses command type and issues command(s) to the proper browser
<index> specifies the type of command this is:
None -> first come, first serve
int -> index of browser to send command to
"""
# Block if the storage controller has too many unfinished records
agg_queue_size = self.storage_controller_handle.get_most_recent_status()
if agg_queue_size >= STORAGE_CONTROLLER_JOB_LIMIT:
while agg_queue_size >= STORAGE_CONTROLLER_JOB_LIMIT:
self.logger.info(
"Blocking command submission until the storage controller "
"is below the max queue size of %d. Current queue "
"length %d. " % (STORAGE_CONTROLLER_JOB_LIMIT, agg_queue_size)
)
agg_queue_size = self.storage_controller_handle.get_status()

def get_most_recent_status(self) -> int:
"""Return the most recent queue size sent from the Storage Controller process"""
# Block until we receive the first status update
if self._last_status is None:
return self.get_status()
# Drain status queue until we receive most recent update
while not self.status_queue.empty():
self._last_status = self.status_queue.get()
self._last_status_received = time.time()
# Check last status signal
if (time.time() - self._last_status_received) > STATUS_TIMEOUT:
raise RuntimeError(
"No status update from the storage controller process "
"for %d seconds." % (time.time() - self._last_status_received)
)
return self._last_status

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions