Commit Graph

1744 Commits

Author SHA1 Message Date
Chrissie Caulfield
2d3cd761cf
test: Clean /dev/shm a bit better (#459)
* test: Clean /dev/shm a bit better

This isn't perfect, but it does tidy more of /dev/shm than
previously. Because some of the tests leave empty directories
we have no way of telling (in resources.test) whether they
belong to this test run, another test run, or a running
application.
2022-03-18 10:04:23 +00:00
Chrissie Caulfield
2d03793eb0
unix: Don't fail on FreeBSD running ZFS (#461)
* unix: Don't fail on FreeBSD running ZFS

ZFS doesn't support posix_fallocate() so libqb IPC or RB would
always fail with EINVAL.

As there seems to be no prospect of a more useful return code,
trap it in a QB_BSD #ifdef. That way if we do have actual errors
in the posix_fallocate() call the Linux tests should still find them.

Also, stick a small sleep in the test_ipc_disconnect_after_created
test to allow the server to shutdown before killing it with SIGTERM
and causing a test failure. all the other uses of it seem to have this
sleep!
2022-03-17 07:47:39 +00:00
Christine Caulfield
f5106342d0 ipcc: Fix errno returned from qb_ipcc_connect
The errno value from qb_ipcc_connect was incorrectly negated
when I introduced qb_ipcc_async_connect()
2022-03-03 07:29:07 +00:00
Ken Gaillot
3fb2b59751 util: reimplement time functions as a series of fallbacks
Previously, when clock_gettime() was available, the time functions would use
that (regardless of success or failure), otherwise they would use
gettimeofday() if available.

Now, the functions first try clock_gettime() if available, but if that is
unavailable or fails, they then try gettimeofday() if available, but if that is
not available or fails, they try time().
2022-02-14 12:25:19 +00:00
Ken Gaillot
da12cc9695 util: use HAVE_GETTIMEOFDAY where appropriate
configure.ac already defined HAVE_GETTIMEOFDAY, but the uses of gettimeofday()
weren't guarded by it. It obviously doesn't matter on any currently supported
platforms, but it will be needed for planned changes.
2022-02-14 12:25:19 +00:00
Ken Gaillot
354c0c2531 util: drop HAVE_CLOCK_GETRES_MONOTONIC configure constant
It doesn't provide a significant benefit over just trying the call.
It was added by 6bd3f086 for Hurd support.
2022-02-14 12:25:19 +00:00
Ken Gaillot
1e67908580 util: add constant for which realtime clock to use
... to reduce code duplication and improve readability
2022-02-14 12:25:19 +00:00
Ken Gaillot
4f82b0b6c4 util: refactor so ifdef's are withing each time-related function
The time-related functions have two implementations, one if clock_gettime() is
available and the other if not.

Previously, there was one big ifdef-else with the clock_gettime()
implementation of each function followed by the other implementation of each
function.

With this commit, each function is defined once, with an ifdef-else inside it
with the two implementations of that function. For ease of review, no other
code changes are made, but the intent will become obvious with later changes.
2022-02-14 12:25:19 +00:00
Chrissie Caulfield
5f8278ac60
Bring the INSTALL guide up-to-date (#456) 2022-02-02 07:21:26 +00:00
Chrissie Caulfield
73472e0b13
Tidy some scripts (#454)
* Tidy some scripts

Errors reported by Centos covscan

I changed %N to %s as BSD's date command doesn't support %N.
Seconds + PID should be enough ....

* Shrink the name of the dlock tests as they cause random failures

When the PID numbers get big, the socket name overflows the allowed
limit

* Increase timeout of thread check.

It's been seen to time out too early and fail the tests
2022-01-19 12:50:45 +00:00
Jakub Jankowski
176eae8f13
Retry if posix_fallocate is interrupted with EINTR (#453)
Every now and then Pacemaker reports errors:

  (pcmk__new_client)        debug: New IPC client 3efdbecf-c2d9-44bc-b4a6-9bcd48021ba1 for PID 27492 with uid 0 and gid 0
  (handle_new_connection)   debug: IPC credentials authenticated (/dev/shm/qb-7271-27492-12-hfPbKY/qb)
  (qb_ipcs_shm_connect)     debug: connecting to client [27492]
  (qb_rb_open_2)    debug: shm size:524301; real_size:528384; rb->word_size:132096
  (qb_rb_open_2)    debug: shm size:524301; real_size:528384; rb->word_size:132096
  (qb_sys_mmap_file_open)   error: couldn't allocate file /dev/shm/qb-7271-27492-12-hfPbKY/qb-event-cib_rw-data: Interrupted system call (4)
  (qb_rb_open_2)    error: couldn't create file for mmap
  (qb_ipcs_shm_rb_open)     error: qb_rb_open:/dev/shm/qb-7271-27492-12-hfPbKY/qb-event-cib_rw: Interrupted system call (4)
  (qb_rb_close_helper)      debug: Free'ing ringbuffer: /dev/shm/qb-7271-27492-12-hfPbKY/qb-response-cib_rw-header
  (qb_rb_close_helper)      debug: Free'ing ringbuffer: /dev/shm/qb-7271-27492-12-hfPbKY/qb-request-cib_rw-header
  (qb_ipcs_shm_connect)     error: shm connection FAILED: Interrupted system call (4)
  (handle_new_connection)   error: Error in connection setup (/dev/shm/qb-7271-27492-12-hfPbKY/qb): Interrupted system call (4)

While it probably might be addressed in Pacemaker code, a simple retry
loop in case posix_fallocate(3) returns EINTR seems to be a decent
workaround.

Fixes: #451

Signed-off-by: Jakub Jankowski <shasta@toxcorp.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
2022-01-14 07:57:25 +00:00
Chrissie Caulfield
de5ab3029c
ipcc: Add an async connect API (#450) 2022-01-05 10:53:09 +00:00
Ferenc Wágner
787940e291 Update changelog for 2.0.4-1 release 2021-11-21 13:44:30 +01:00
Ferenc Wágner
f39240a0e0 Update Standards-Version to 4.6.0 (no changes required) 2021-11-21 13:43:50 +01:00
Ferenc Wágner
27aa24ad7c Update our patches 2021-11-21 13:43:20 +01:00
Ferenc Wágner
a192326fd4 Update upstream source from tag 'upstream/2.0.4'
Update to upstream version '2.0.4'
with Debian dir b4daec9d16
2021-11-21 13:42:41 +01:00
Ferenc Wágner
b91c3e4791 New upstream version 2.0.4 2021-11-21 13:42:35 +01:00
Ferenc Wágner
8e4f95a36d New upstream signing key: 0x08C81B2C6CE95CA7 2021-11-21 13:40:42 +01:00
Christine Caulfield
a2691b9618 Bump library version for v2.0.4 2021-11-12 13:18:47 +00:00
Chrissie Caulfield
d4b49fb5e9
poll: Don't log in a signal handler (#447)
qb_log calls malloc() and probably many other non-signal-safe
functions, so don't call it in the signal handler.

Thanks to Honza for spotting this

Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
2021-11-10 12:35:07 +00:00
Chrissie Caulfield
a60ca50b67
Fix pthread returns (#444)
pthread calls do not set errno, they return the error directly
2021-08-11 07:55:42 +01:00
Chrissie Caulfield
fa59903037
doxygen2man: print structure descriptions (#443)
* doxygen2man: print structure descriptions
* get rid of double-cast as it doesn't seem to do anything
2021-07-01 09:33:58 +01:00
Jan Friesse
48fff5eb58
Implement heap based timer list (#439)
* tlist: Add heap based implementation of timer list

Previous timer was sorted list implementation of priority queue
and very slow when number of timers increased. This is mostly
not a problem because usually only few timers are used.
But for application where bigger number of timers are needed
it may become problem.

Solution is to use binary heap based priority queue which is much
faster.

API is unchanged, just timerlist_destroy is added which should be called
to free heap array. This function also destroys mutex (omitted when
mutex was added).

* tests: Fix check loop mt test

test_th was accesed both by main thread and loop_timer thread resulting in
failure. Fix is to access test_tht in loop_timer thread.

Speed test is adding only 10000 items so it is reasonable
fast even with sorted linked list implementation.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
2021-03-18 07:27:25 +00:00
orbea
9e1e3a2f4b
build: Fix undefined pthread reference. (#440) 2021-03-17 09:32:51 +00:00
Ferenc Wágner
dd781034ff Update changelog for 2.0.3-1 release 2021-03-04 06:11:53 +01:00
Ferenc Wágner
bee0959355 Acknowledge new symbols 2021-03-04 06:10:02 +01:00
Ferenc Wágner
ff0eed738b Delete upstream patch, refresh the rest 2021-03-04 05:51:31 +01:00
Ferenc Wágner
f0b428b5b8 Update upstream source from tag 'upstream/2.0.3'
Update to upstream version '2.0.3'
with Debian dir ef120ac2b5
2021-03-04 05:50:14 +01:00
Ferenc Wágner
86a316c09e New upstream version 2.0.3 2021-03-04 05:50:06 +01:00
Christine Caulfield
404adbcd99 release: bump library version for 2.0.3 release 2021-03-03 08:32:09 +00:00
Aleksei Burlakov
aae7a0aa5d
syslog: Add a message-id parameter for messages (#433)
The message-id parameter will enable systemd catalogs.
To enable message-id's the libqb should be configured with the
 --enable-systemd-journal option.

Co-authored-by: root <Aleksei Burlakov>
2021-03-01 15:58:50 +00:00
Chrissie Caulfield
c7e1afefae
tests: Fix up resources.test (#435)
resources.test has not checked the right filenames for a while.
Fix this, and also make sure we don't count (but remove) the dlock
test files.
2021-02-08 11:01:13 +00:00
Chrissie Caulfield
d6e2bd1d6b
timers: Add some locking (#436)
Fix several locking issues reported by helgrind
2021-02-08 10:57:42 +00:00
Chrissie Caulfield
991872eded
ipcc: Have a few goes at tidying up after a dead server (#434)
This is an attempt to make sure that /dev/shm is cleaned up when a
server exits unexpectedly. Normally it's the server's responsibility
to tidy up sockets, but if it crashes or is killed with SIGKILL then
the client (us) makes a reasonable attempt to tidy up the server sockets
we have connected. The extra delay here just gives the server chance to
disappear fully. As a client we can get here pretty quickly but shutting
down a large server may take a little longer even when SIGKILLed.
The 1/100th of a second is an arbitrary delay (of course) but seems to
catch most servers in 2 tries or less.
2021-01-25 12:19:10 +00:00
Chrissie Caulfield
5097155bdf
strlcpy: Check for maxlen underflow (#432)
* strlcpy: Check for maxlen underflow

https://github.com/ClusterLabs/libqb/issues/429

* Always terminate the string if maxlen is > 0
2021-01-13 14:12:02 +00:00
Chrissie Caulfield
47ed440397
doxygen2man: fix printing of lines starting with '.' (#431)
if a line starts with a '.' (eg the '...' in qbarray.h) then
nroff thinks it's looking for a macro called '..'.

The easiest solution is to add a dummy format at the start of the line
(just adding \ seems not to work).
2021-01-07 09:08:46 +00:00
wferi
5b16d504ff
doxygen2man: ignore all-whitespace brief descriptions (#430) 2021-01-04 09:08:18 +00:00
Ferenc Wágner
5a0fb13101 Update changelog for 2.0.2-1 release 2020-12-26 16:07:57 +01:00
Ferenc Wágner
6f165b3f06 New patch: doxygen2man: ignore all-whitespace brief description 2020-12-26 16:07:22 +01:00
Ferenc Wágner
50ead693bb New patch: Fix typos and inconsistencies in doxygen2man help text 2020-12-25 16:19:24 +01:00
Ferenc Wágner
7b1a007be9 Update Standards-Version to 4.5.1 (no changes required) 2020-12-25 16:19:24 +01:00
Ferenc Wágner
cef7c9dddb Update symbols file 2020-12-25 16:19:24 +01:00
Ferenc Wágner
313b9f7738 Remove upstreamed patches, refresh the rest 2020-12-25 12:09:23 +01:00
Ferenc Wágner
744f11b358 Update upstream source from tag 'upstream/2.0.2'
Update to upstream version '2.0.2'
with Debian dir 6d9fecd282
2020-12-25 11:55:14 +01:00
Ferenc Wágner
61203efbb2 New upstream version 2.0.2 2020-12-25 11:55:09 +01:00
Christine Caulfield
def947efcf lib: Update library version for 2.0.2 release
Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
2020-12-03 13:05:43 +00:00
Hideo Yamauchi
51f181b3cd
ipcs : Decrease log level. (#426)
of ipcs event notification 'errors' that can occur in normal use.
2020-12-03 11:33:30 +00:00
Chrissie Caulfield
06ac2d43a9
cov: Quieten some covscan warnings (#427) 2020-12-03 09:39:28 +00:00
Ferenc Wágner
afb08709f3 libqb-tools took over qb-blackbox from libqb-dev (<< 2)
Thanks: Andreas Beckmann
Closes: #973651
2020-11-04 15:36:15 +01:00
Ferenc Wágner
425c9e6bbb Update changelog for 2.0.1-1 release 2020-10-30 12:56:30 +01:00