Changes to files with file descriptors open not detected

Bug #649111 reported by Jesse on 2010-09-27
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ubuntu One Client
Medium
Ubuntu One Foundations+ team
ubuntuone-client (Ubuntu)
Undecided
Unassigned

Bug Description

Binary package hint: ubuntuone-client

Ubuntu One Sync Daemon won't rescan a changed file if the file has processes still opening it for write. This causes problems when some session-wide opened files are put in sync, where the only chance of a file close event is the user logging out, when ubuntuone-syncdaemon itself is also being shutdown.

Steps to reproduce:

1. Add a user defined directory ~/foo
2. create a file hello.txt with content "hello\n"
3. change the content of the file into "heLLO" in a process, flush out the change but keep the file open [2]

Expected behavior:
Ubuntu One Sync Daemon detects the change and updates the local hash and stat info accordingly. (How it schedules the upload of change is another story)

Actual behavior:
Ubuntu One won't detect the change until the file is closed.

auxiliary scripts to automate reproduction of this bug:

[1] tu.sh, referencing u.py [2]
#!/bin/bash

cd ~/foo
echo "hello" > hello.txt; sha1sum hello.txt; echo $((0x`crc32 hello.txt`)); u1sdtool -s;
sleep 1; u1sdtool --info ~/foo/hello.txt | egrep --color 'crc|hash|stat'
echo

cp hello.txt /tmp/hello.txt
python /tmp/u.py &
echo $((0x`crc32 hello.txt`)); sha1sum hello.txt; u1sdtool -s;
fuser hello.txt
sleep 3; u1sdtool -s; u1sdtool --info ~/foo/hello.txt | egrep --color 'crc|hash|stat'
wait %1
[2] u.py
#!/usr/bin/python

import time

with open("/home/jesse/foo/hello.txt", "w+") as f:
    f.write("heLLO")
    f.flush()
    time.sleep(5)

ProblemType: Bug
DistroRelease: Ubuntu 10.04
Package: ubuntuone-client 1.2.2-0ubuntu2
ProcVersionSignature: Ubuntu 2.6.32-24.43-generic 2.6.32.15+drm33.5
Uname: Linux 2.6.32-24-generic x86_64
Architecture: amd64
Date: Mon Sep 27 22:06:02 2010
EcryptfsInUse: Yes
InstallationMedia: Ubuntu 10.04 "Lucid Lynx" - Beta amd64 (20100318)
PackageArchitecture: all
ProcEnviron:
 PATH=(custom, user)
 LANG=en_US.utf8
 SHELL=/bin/bash
SourcePackage: ubuntuone-client
UbuntuOneClientConfig:
 [ubuntuone]
 bookmarked = True
 connected = True
 connect = 0
 show_applet = 1
UbuntuOneUserSyncdaemonConfig:
 [bandwidth_throttling]
 read_limit = 2097152
 write_limit = 2097152
 on = False

Jesse (sbjesse) wrote :
Jesse (sbjesse) wrote :

My guess is that somewhere in the daemon it has only added the IN_CLOSE_WRITE event for inotify. I haven't gone through the source code, but a simple script that opens and closes the file kind of validates my hypothesis: after running the script, u1 picks up the change and uploads as expected.

Roman Yepishev (rye) on 2011-02-15
Changed in ubuntuone-client (Ubuntu):
status: New → Confirmed
Changed in ubuntuone-client:
assignee: nobody → Ubuntu One Foundations+ team (ubuntuone-foundations+)
importance: Undecided → Medium
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers