Any change of rsync using threads instead of fork?

Jamie Lokier jamie at shareable.org
Tue Dec 20 00:35:22 GMT 2005


Wayne Davison wrote:
> On Sat, Dec 17, 2005 at 11:22:58PM +0000, Jamie Lokier wrote:
> >   rsync: mkstemp "/mnt/storage/bin/" failed: Success (0)
> 
> That makes me wonder if the thread handling is not properly giving
> each thread its own errno.

I agree, that seems likely.  Unfortunately I don't have great
debugging tools, and figuring out why is proving tricky.

> >   ./rsync: io.c: 334: push_redo_num: Assertion `am_receiver()' failed.
> 
> That should only occur (that I know of) if pthread_self() isn't
> returning the right value.
> 
> Perhaps your file-I/O routines are not thread-safe?  I'd suggest
> downloading GNU pth and trying out rsync using that.  Be sure to
> configure *pth* with "--enable-syscall-soft --enable-pthread", build it,

That's an excellent suggestion, and I've just tried it.

It's necessary to include Pth's <pthread.h> _before_ uclibc system
header files, like <sys/types.h>, because the latter defines types
like pthread_t unconditionally (even when not linking with "real"
threads).  There are lots of redefinition warnings and errors.

So I put "-include pthread.h" in the Makefile, to include Pth's
<pthread.h> before anything.  That makes it compile fine.

Running: it's fine for connecting to a server and listing.  Fetching
files works better than before, with a couple of files arriving.
However, then I see Illegal Instruction.  More to debug.

(It does not help that I have an older cross-compiler, which is more
"official" for the kit I'm using, and which might work with these
libraries better, but which crashes when compiling the large functions
in generator.c and receiver.c.)

There is another quirk, which might apply to all Linux systems:

libc contains utimes(), so HAVE_UTIMES is defined.  But it returns
ENOSYS, so rsync complains and fails to set times.  This is because
the kernel (ARM linux 2.4.26) does not have utimes().  In fact,
utimes() was added to approximately Linux 2.6.0 on many architectures
(it varies).

Undefining HAVE_UTIMES fixes this.  It might be better for rsync to
fall back to utime() when utimes() returns ENOSYS.  If you do decide
to depend on ENOSYS in a portable way, consider setting SIGSYS to
SIG_IGN too.

Thanks for your time!
-- Jamie


More information about the rsync mailing list