[vz-dev] [volkszaehler/vzlogger] 9b9f1c: Lock std::list::size in Buffer, make it thread saf...

GitHub noreply at github.com
Mon Aug 22 22:32:52 CEST 2016


  Branch: refs/heads/master
  Home:   https://github.com/volkszaehler/vzlogger
  Commit: 9b9f1c982fe217e58da5b5811fed60d4dc64cee7
      https://github.com/volkszaehler/vzlogger/commit/9b9f1c982fe217e58da5b5811fed60d4dc64cee7
  Author: Florian Achleitner <flo at fopen.at>
  Date:   2016-08-05 (Fri, 05 Aug 2016)

  Changed paths:
    M include/Buffer.hpp

  Log Message:
  -----------
  Lock std::list::size in Buffer, make it thread safe

This fixes random race/invalidate crashes when debug
messages are enabled, which dump the buffer.


  Commit: 31a53250583f071a5fc1dc793173fc9393c3465c
      https://github.com/volkszaehler/vzlogger/commit/31a53250583f071a5fc1dc793173fc9393c3465c
  Author: Florian Achleitner <flo at fopen.at>
  Date:   2016-08-05 (Fri, 05 Aug 2016)

  Changed paths:
    M src/threads.cpp

  Log Message:
  -----------
  reading_thread: remove unused variable


  Commit: 5c4762611b44038a4a7b5509a0806d9fa8867e73
      https://github.com/volkszaehler/vzlogger/commit/5c4762611b44038a4a7b5509a0806d9fa8867e73
  Author: Florian Achleitner <flo at fopen.at>
  Date:   2016-08-21 (Sun, 21 Aug 2016)

  Changed paths:
    M include/Buffer.hpp
    M include/Channel.hpp
    M src/Buffer.cpp
    M src/threads.cpp

  Log Message:
  -----------
  Remove C heap access and buffer magic for debug output

Unused cleanup functions call free() on C++ objects.
This must not happen, thus remove them entirely.

Debug output uses a complicated C malloc/free heap buffer
C++ify it, and make it much simpler.


  Commit: d094328f1c7167cc062e99b6e9e2d4c6a3bb94e3
      https://github.com/volkszaehler/vzlogger/commit/d094328f1c7167cc062e99b6e9e2d4c6a3bb94e3
  Author: Florian Achleitner <flo at fopen.at>
  Date:   2016-08-21 (Sun, 21 Aug 2016)

  Changed paths:
    M src/threads.cpp

  Log Message:
  -----------
  Initialize empty readings with vector constructor


  Commit: 15fc454a3d3dd2121bcabb2546f2c96a2484d253
      https://github.com/volkszaehler/vzlogger/commit/15fc454a3d3dd2121bcabb2546f2c96a2484d253
  Author: Florian Achleitner <flo at fopen.at>
  Date:   2016-08-21 (Sun, 21 Aug 2016)

  Changed paths:
    M include/Channel.hpp
    M src/MeterMap.cpp
    M src/threads.cpp

  Log Message:
  -----------
  Fix memory violation: shared pointer passed to logging thread

logging_thread runs in a thread and is passed a Channel* as a void*
argument via pthread_create. Then, a shared_ptr takes over the Channel*
via reset() in logging_thread. This effectively gives ownership to the
shared_ptr.
This is incorrect, because the Channel is owned by another shared_ptr
outside of the thread. Passing a raw Channel* breaks the shared_ptr
semantics.

When the logging_thread ends, the shared_ptr deletes the Channel.
However, outside of logging_thread it is still used by a seperate
shared_ptr group. This causes crashes, double delete...
(It can be observed as crash on shutdown and with valgrind.)

Work around this problem by holding a shared_ptr to represent a link to
in the logging thread. Using std::thread would be nicer, but would
require a bigger patch.


  Commit: ac12e393f2750988cbde2b3b108dd7b4fbe405d9
      https://github.com/volkszaehler/vzlogger/commit/ac12e393f2750988cbde2b3b108dd7b4fbe405d9
  Author: Florian Achleitner <flo at fopen.at>
  Date:   2016-08-21 (Sun, 21 Aug 2016)

  Changed paths:
    M include/Channel.hpp

  Log Message:
  -----------
  Join a Channel thread only if possible, fix crash

pthread_join on threads which are not joinable leads to crashes.
Channel threads are not started unconditionally.

Thus, prevent calls to pthread_join if the thread is already
joined or was never created. This fixes crashes on shutdown.


  Commit: dd28a42d78190669417781800d4389aafbb2bb95
      https://github.com/volkszaehler/vzlogger/commit/dd28a42d78190669417781800d4389aafbb2bb95
  Author: Florian Achleitner <flo at fopen.at>
  Date:   2016-08-21 (Sun, 21 Aug 2016)

  Changed paths:
    M include/Channel.hpp
    M src/MeterMap.cpp
    M tests/mocks/Channel.hpp
    M tests/mocks/mock_metermap.cpp

  Log Message:
  -----------
  Update mocks for Channel, Channel::start non-static

Google mocks can't mock static functions easily.


  Commit: 1484f9aad1bc21cfbfe1f8abbecede6640d6813b
      https://github.com/volkszaehler/vzlogger/commit/1484f9aad1bc21cfbfe1f8abbecede6640d6813b
  Author: andig <cpuidle at gmx.de>
  Date:   2016-08-22 (Mon, 22 Aug 2016)

  Changed paths:
    M include/Buffer.hpp
    M include/Channel.hpp
    M src/Buffer.cpp
    M src/MeterMap.cpp
    M src/threads.cpp
    M tests/mocks/Channel.hpp
    M tests/mocks/mock_metermap.cpp

  Log Message:
  -----------
  Merge pull request #271 from flyingflo/upstr-fixes

A collection of small fixes and improvements


Compare: https://github.com/volkszaehler/vzlogger/compare/8324cddc3032...1484f9aad1bc


More information about the volkszaehler-dev mailing list