redmine

multiple bugfixes:

> --synctimeout=0 disables the timeout
> fixed 2 memleak situations
> fixed thread manager's data corruption
> fixed signal handeling
few another problems fixes
... ... @@ -3,4 +3,7 @@
3. Remove all code with "#ifdef DOXYGEN"
4. Find-out is "pthread_tryjoin_np()" really required? Can we remove all this
"threadsinfo" mechanism?
There's a memleak if not pthread_*join*() is done.
5. Deduplicate code from functions, that calls sync_exec() and sync_exec_thread()
... ...
... ... @@ -70,6 +70,12 @@
#define IN_CREATE_SELF IN_CREATE
#endif
#ifdef _DEBUG
#define DEBUGV(...) __VA_ARGS__
#else
#define DEBUGV(...) {}
#endif
#define COLLECTDELAY_INSTANT ((unsigned int)~0)
enum flags_enum {
... ... @@ -118,7 +124,8 @@ typedef enum ruleaction_enum ruleaction_t;
// signals (man 7 signal)
enum sigusr_enum {
SIGUSR_PTHREAD_GC = 10,
SIGUSR_INITSYNC = 12
SIGUSR_INITSYNC = 12,
SIGUSR_BLOPINT = 16
};
struct rule {
... ... @@ -176,8 +183,9 @@ enum state_enum {
STATE_EXIT = 0,
STATE_RUNNING,
STATE_REHASH,
STATE_TERM//,
// STATE_PTHREAD_GC
STATE_TERM,
STATE_PTHREAD_GC,
STATE_INITSYNC
};
typedef enum state_enum state_t;
... ... @@ -216,17 +224,20 @@ struct threadinfo {
options_t *options_p;
time_t starttime;
time_t expiretime;
int child_pid;
};
typedef struct threadinfo threadinfo_t;
struct threadsinfo {
#ifdef PTHREAD_MUTEX
pthread_mutex_t _mutex;
char _mutex_init;
pthread_mutex_t _mutex;
char _mutex_init;
#endif
int allocated;
int used;
threadinfo_t *threads;
int allocated;
int used;
threadinfo_t *threads;
threadinfo_t **threadsstack; // stack of threadinfo_t to be used on thread_new()
int stacklen;
};
typedef struct threadsinfo threadsinfo_t;
... ... @@ -244,10 +255,18 @@ struct dosync_arg {
enum initsync {
INITSYNC_UNKNOWN = 0,
INITSYNC_FIRST,
INITSYNC_SUBDIR,
INITSYNC_RESYNC
INITSYNC_FULL,
INITSYNC_SUBDIR
};
typedef enum initsync initsync_t;
struct sighandler_arg {
// options_t *options_p;
// indexes_t *indexes_p;
pthread_t pthread_parent;
int *exitcode_p;
sigset_t *sigset_p;
};
typedef struct sighandler_arg sighandler_arg_t;
... ...
... ... @@ -63,6 +63,19 @@ Daemonize, forcing clsync to fork() on start.
Use
.BR pthreads (7)
to parallelize syncing processes.
If you're running
.B clsync
with option
.B \-\-pthread
in conjunction with
.B rsync
with option
.B \-\-backup
, you may catch a bug due to nonatomicity of rsync's file replace operation.
(see
.B DIAGNOSTICS
)
.RE
.PP
... ... @@ -226,6 +239,8 @@ will die if syncing process alive more than
.I sync-timeout
seconds.
Set "0" to disable the timeout.
Default value is "86400" ["24 hours"].
.RE
... ... @@ -488,19 +503,48 @@ The following diagnostics may be issued on stderr:
Error: Cannot inotify_add_watch() on [...]
.RS
Not enough watching descriptors of inotify is allowed. It can be fixed
Not enough inotify watching descriptors is allowed. It can be fixed
by increasing value of "sysctl fs.inotify.max_user_watches"
.RE
Error: Got non-zero exitcode [...]
Error: Got non-zero exitcode
.I exitcode
[...]
.RS
.I action-script
returned non-zero exitcode. Probably, you should process exitcodes in it or
your syncer process didn't worked well. This may happend, for example if out
of space.
your syncer process didn't worked well. I case of using rsync, you can find
the exitcodes meanings in
.B man 1 rsync
\*S.
If
.I exitcode
equals to 23 and you're using
.B clsync
in conjunction with
.B rsync
, this may happend, for example in next cases:
.RS
\- Not enough space on destination.
\- You're running clsync with
.B \-\-pthread
and rsync with
.B \-\-backup
\*S. See bugreport by URL:
.I https://bugzilla.samba.org/show_bug.cgi?id=10081
\*S.
.RE
To confirm the problem, you can try to add "return 0" or "exit 0" into
your script.
your
.I action-script
\*S.
.RE
.SH EXAMPLES
... ...
This diff is collapsed. Click to expand it.