Error while calling o430.mount and the executor has failed to refresh mounts

Use the refreshMounts command.

Written by alberto.umana

Last published at: November 17th, 2024

Problem

When attempting to run dbutils.fs.unmount(mounting_point) over a notebook using an all-purpose cluster, you receive an error message.

 

Answer: ExecutionError: An error occurred while calling o430.mount.
: java.lang.Exception: Executor 58 has failed to refresh mounts. Reads and writes can be inconsistent. Call refreshMounts(). If the problem persists after a few minutes, try restarting the cluster, or contact Databricks support.

 

Cause

Mounting and unmounting operations are not atomic or transactional, which can lead to executor inconsistencies while refreshing the mount status.

 

Solution

  • Use the command dbutils.fs.refreshMounts() before a mount operation to ensure that all executors are updated.
  • Follow the error message, call refreshMounts, and do not call mount/unmount operations again if the error occurs.
  • Implement the following code logic to handle the failure. 

 

  from time import sleep
try:
   dbutils.fs.unmount(mount_path)
except Exception as e:
   if "failed to refresh mounts" in str(e).lower():
       dbutils.fs.refreshMounts()
       print('Refreshing mounts... waiting for 3 min...')
       sleep(180)
   else:
       # If the error is different, raise it or handle it differently
       raise e