Commit Graph
412 Commits
Author SHA1 Message Date
andrey 49dc3cefe7 fix(picloud-dispatcher): drop data to a connection whose write is stalled
While the peer does not drain its receive buffer, every forwarded packet
would re-stall the reader thread for up to writeTimeout(), so a queued
Disconnect frame could wait behind the whole backlog. Remember a stalled
target (send slower than 2 s) and drop data for a short cooldown instead
of stalling; keep dispatcher writes bounded at 3 s. Control frames
(Connected/Disconnected) are unaffected.
2026-08-24 15:14:45 +03:00
andrey 22a09ddd1c fix(picloud-dispatcher): start read thread under the lock and drain rmrf_* in the destructor
newConnection pushed the client into clients while holding map_mutex
but started its read thread after releasing it; in that window the
client was a live member of clients with no read thread and could be
marked, closed and deleted by the drainer before start() ran. Start
the thread inside the locked section: the thread can only wait for
map_mutex after the function has released it, so this is not a
deadlock, and the 'everything in clients is started' invariant holds.

~DispatcherServer dropped clients/servers pending in rmrf_clients/
rmrf_servers without closing or deleting them (object leak of live
PIObjects). Collect them together with the main maps, then run the
same stop/close/delete sequence. The sets are disjoint with the main
maps by construction (items are removed from the main maps when
marked), so there are no duplicates.
2026-08-23 18:55:15 +03:00
andrey 1ec61a0127 fix(picloud-dispatcher): forward data to sub-client under mutex_clients
The dataReadedServer lambda looked up the sub-client under
mutex_clients but called sendData() after the unlock; the client could
be deleted by the drainer in between (same UAF pattern that was fixed
in PICloudServer::_readed). Keep the send inside the locked section:
sendData only takes mutex_send/prog_s_mutex downstream, so the lock
hold is bounded.
2026-08-23 18:55:00 +03:00
andrey 48d6ffaac1 Merge branch 'master' into fix_picloud_dispatcher 2026-08-23 17:19:06 +03:00
andrey cc8e8644f1 fix(picloud-dispatcher): do not close/delete clients under map_mutex — deadlock
cleanClients() (timer thread) called close()/stopAndWait() and
disconnectClient() (read thread) did the same while holding
map_mutex, while client read threads wait for the same lock in
registerServer/registerClient/disconnectClient — a guaranteed
deadlock (the -w watchdog aborts exactly this). disconnectClient
could also wait for its own read thread (self-wait in
waitThreadedReadFinished) and the destructor never stopped the timer
or drained the clients, leaving dangling lambda captures of this.

Restructure around a single drainer (the timer thread):
- cleanClients: under map_mutex only mark (move rmrf_* out, mark
  ping-timeout/orphaned clients); after the unlock close
  (stopAndWait) and delete the connections, then delete the servers
- disconnectClient: only mark under the lock, then request a
  non-blocking stop() on the affected connections; the drainer waits
  and deletes (no self-wait, nothing blocks while holding the lock)
- newConnection: start the read thread after releasing the lock
- ~DispatcherServer: stop watchdog/timer first, then close and delete
  all clients before the servers (raw-pointer order) and eth

The watchdog is now a PIThread member so the destructor can stop it;
setMaxConnections takes map_mutex like its readers.
2026-08-23 17:18:03 +03:00
andrey ddab6909b4 fix(picloud-dispatcher): guard CloudServer::stop() and last_ping with mutex_clients
stop() iterated clients while addClient()/removeClient() modified it
from other threads (reallocated vector iterators, data race). Copy the
list under mutex_clients and close the copy.

last_ping (PITimeMeasurer) was reset from the read thread
(dataReadedServer/pingReceived) without any lock while cleanClients
read it via lastPing() in the timer thread. Reset and read it under
mutex_clients (lock order map_mutex -> mutex_clients, consistent with
the registerClient path).
2026-08-23 17:17:53 +03:00
andrey 9214e805d9 add rpm support for deploy_tool 2026-08-11 19:04:33 +03:00
andrey 7b5c5d939b Add parents (de)serialization in pip_cmg 2026-05-27 15:44:08 +03:00
peri4 fe3b30bd49 version 5.6.1
patch deploy_tool: procDpkg now prioritize "non-cross" and "non-dev" packages, then only "non-cross"
add PIP_MANUAL_TEST CMake option
2026-03-20 13:00:24 +03:00
peri4 563d9c5487 value_tree_translator: add toolTip 2026-01-22 11:48:29 +03:00
peri4 5f3baa5580 PICODEINFO::accessOffsetFunction
add offset generation in pip_cmg for retrieve bytes offset of struct member
add pip_cmg -V doc
2025-09-18 17:12:35 +03:00
peri4 7083b2c32b finish codeparser improvements
pip_cmg now works with new nested entities approach
Getters now can access to bitfields
2025-09-18 05:54:31 +03:00
peri4 2928a690b8 remove debug 2025-09-10 16:07:19 +03:00
peri4 220ce225f8 dpkg spaces not valid 2025-09-10 16:05:26 +03:00
peri4 ac89c499ab start debug 2025-09-10 15:55:19 +03:00
peri4 40cda7d988 fix last deploy_tool patch 2025-09-05 21:56:59 +03:00
peri4 a299ada873 PIFile::readAll release
patch deploy_tool: ignore libc.so and take last dpkg dependency instead of first
2025-09-05 21:46:44 +03:00
peri4 a3615c5666 piDe/SerializeJSON with PIJSON type, some doc 2025-08-14 17:34:12 +03:00
andrey da30ae558f add process tests 2025-08-13 14:09:18 +03:00
peri4 cf25cacc17 decompose pip_cmg
add serialization/pijsonserialization.h for JSON de/serialization
add -J flag for pip_cmg to make JSON serialization methods
not finished yet, but basically workable now
2025-08-02 18:48:38 +03:00
peri4 d01baffb0b PITimeMeasurer remove some API, add elapsedAndReset()
got rid off some warnings
2025-01-17 11:49:24 +03:00
peri4 f334a6603f adopt for new MinGW 2025-01-06 12:55:44 +03:00
peri4 15548de79c version 4.5.0
PIThread::stopAndWait now returns bool
PIKbdListener on Linux now use piwaitevent_p and can immediately stop
new base method piZeroMemory, also migrate all "memset 0" to piZeroMemory
2024-12-29 11:48:24 +03:00
peri4 49713ddc57 PIThread now setup itself in thread func 2024-12-29 10:50:38 +03:00
peri4 9b8a1583c2 add "--no-strip" flag to deploy_tool 2024-12-03 11:19:14 +03:00
peri4 9ab46e4afc version 4.4.1
PIVector and PIDeque now growth to 64 MiB with PoT, then increments size by 64 MiB
in case of large containers it significantly save memory
2024-11-21 00:10:14 +03:00
peri4 caa7880cc4 get rid of piForeach
apply some code analyzer recommendations
ICU flag now check if libicu exists
prepare for more accurate growth of containers (limited PoT, then constantly increase size)
2024-11-20 20:01:47 +03:00
peri4 3d07795515 add_custom_command(... pip_lang) on ninja brings to resursive cmake and ninja call ( 2024-11-15 15:43:03 +03:00
peri4 57f8c1313e first release of translation facility
* runtime - loading and translating
 * design-time - works with *.ts file (pip_tr utility)
 * compile-time - CMake macro for compile *.ts
2024-11-05 13:49:00 +03:00
peri4 73ed51e3d4 translations: multi-line and special symbols support 2024-11-03 18:12:32 +03:00
peri4 b43158d3a8 add PIString::lineNumber() method
add ""_tr literal to translate string by PITranslator
add pip_tr util, now useless, only can generate *.ts
add qt_support internal lib, now only works with *.ts file
pip_vtt migrate to qt_support
2024-11-03 14:39:42 +03:00
peri4 9a928f6feb add PITranslator
begin localization "ru"
2024-11-02 18:43:30 +03:00
peri4 92a87a0c64 picloud add "-w" option for watchdog 2024-10-15 15:04:39 +03:00
peri4 e186e0adff shorter thread names 2024-09-17 15:58:06 +03:00
peri4 000ce2a54d PICout improvement:
* renamed private members for more clear code
 * registerExternalBufferID() method to obtain unique ID for withExternalBuffer()
 * PICoutManipulators::PICoutStdStream enum for select stream (stdout or stderr)
 * Constructors now accept optional stream
 * piCerr and piCerrObj macros

PIDir::temporary() moved to "mkdtemp"

PILog:
 * now 4 levels
 * you can set max level
 * Error writes to piCerr
2024-09-16 16:06:07 +03:00
peri4 16a818c95e picloud hang fix try :`-( 2024-09-06 08:05:26 +03:00
peri4 7d02f710ea add PIPackedTCP 2024-08-02 14:43:42 +03:00
peri4 1c7fc39b6c version 4.0.0_alpha
in almost all methods removed timeouts in milliseconds, replaced to PISystemTime
PITimer rewrite, remove internal impl, now only thread implementation, API similar to PIThread
PITimer API no longer pass void*
PIPeer, PIConnection improved stability on reinit and exit
PISystemTime new methods
pisd now exit without hanging
2024-07-30 14:18:02 +03:00
peri4 d46b5e008a try to fix cloud again 2024-06-01 22:27:39 +03:00
peri4 d97798d063 version 3.18.1
fix pip_cmg - ignore static members
2024-04-30 15:23:26 +03:00
peri4 ee4d78d2e1 add PISet::const_iterator, now can iterate ranged-for PISet by T, not by PIPair<T, bool> 2024-04-05 17:13:18 +03:00
peri4 fb68a9f9fe another segv on cloud 2024-03-31 20:31:35 +03:00
peri4 c7c3852747 cloud! finally fixed bug! 2024-03-25 22:40:29 +03:00
peri4 c18d0c918e 4 2024-03-25 21:45:59 +03:00
peri4 9c4fd41eef 3 2024-03-25 21:37:05 +03:00
peri4 9173dc936d 2 2024-03-25 21:34:30 +03:00
peri4 77c8681b43 1 2024-03-25 21:31:41 +03:00
peri4 2db9440a38 fix cloud ... :-/ 2024-03-25 21:24:29 +03:00
peri4 0d585cfebf cloud fix ... (( 2024-03-25 21:17:05 +03:00
peri4 02a9bfb76f another try fix 2024-03-22 22:29:14 +03:00