diff --git a/python/ray/_private/runtime_env.py b/python/ray/_private/runtime_env.py
index <HASH>..<HASH> 100644
--- a/python/ray/_private/runtime_env.py
+++ b/python/ray/_private/runtime_env.py
@@ -139,9 +139,9 @@ def _hash_modules(path: Path) -> bytes:
         if not Path(from_file_name).is_dir():
             with open(from_file_name, mode="rb") as f:
                 data = f.read(BUF_SIZE)
-                if not data:
-                    break
-                md5.update(data)
+                while len(data) != 0:
+                    md5.update(data)
+                    data = f.read(BUF_SIZE)
         hash_val = _xor_bytes(hash_val, md5.digest())
     return hash_val
[runtime_env] Continue hashing if data is none (#<I>)