Commit Graph

991 Commits

Author SHA1 Message Date
Alejandro García
26e68f8412
Update data stores for v1.9.10 2023-04-09 12:32:55 +02:00
Christoph Atteneder
b1110058c2
Update data stores for v1.9.10 2023-04-07 18:11:46 +02:00
Alejandro García
68124302db
Update BurningManAccountingStore for v1.9.10 2023-04-06 16:18:49 +10:00
Alejandro García
31008865c3
Update data stores for v1.9.10 2023-04-03 10:39:44 +10:00
Alva Swanson
4c6c9100b3
Implement NetworkStatisticsService
The NetworkStatisticsService is an attempt to decouple the network
statistic computation from the UI thread. Here, the
NetworkStatisticsService schedules repeating tasks on a
ScheduledExecutorService.
2023-02-15 20:35:58 +02:00
Alejandro García
bed76128b7
Merge pull request #6580 from alvasw/server_remove_redundant_is_stopped_bool
Server: Remove redundant isStopped boolean
2023-02-15 18:32:57 +00:00
Alejandro García
3dc3464114
Merge pull request #6581 from alvasw/rename_network_filter_to_ban_filter
Rename NetworkFilter to BanFilter
2023-02-15 18:24:55 +00:00
Alva Swanson
d411ae1252
Remove unused ConnectionListener.onError(...) method 2023-02-12 20:44:38 +02:00
Alva Swanson
f9a0e5d6d0
Rename NetworkFilter to BanFilter 2023-02-12 20:30:58 +02:00
Alva Swanson
81a224bfea
Server: Remove redundant isStopped boolean
We can track the server status with the interrupted status of the
server thread. The isStopped boolean is not needed.
2023-02-12 20:23:25 +02:00
Alejandro García
b4822761a8
Merge pull request #6578 from alvasw/server_extract_running_check_to_is_active_method
Server: Extract isStopped check to method
2023-02-12 18:13:49 +00:00
Alejandro García
f00152d42f
Merge pull request #6577 from alvasw/server_switch_to_atomic_is_stopped_bool
Server: Switch to atomic isStopped boolean
2023-02-12 18:13:05 +00:00
Alejandro García
4a4e13c5da
Merge pull request #6576 from alvasw/move_server_thread_to_server_class
NetworkNode: Move server threading logic to server
2023-02-12 18:12:13 +00:00
Alva Swanson
2127e0745c
Server: Extract isStopped check to method 2023-02-11 22:19:43 +02:00
Alva Swanson
3cd24d67ed
Server: Switch to atomic isStopped boolean 2023-02-11 21:41:50 +02:00
Alva Swanson
ee2157aa24
NetworkNode: Move server threading logic to server 2023-02-11 21:40:55 +02:00
Alva Swanson
20c7dc3777
Connection: Rename singleThreadExecutor to executorService 2023-02-07 11:58:56 +01:00
Alva Swanson
b1e16f2748
Connection: Pass uid to executor service name 2023-02-07 11:58:10 +01:00
Alejandro García
b1e2cb03ad
Merge pull request #6568 from alvasw/gradle_apply_central_bisq_java_conventions
Gradle apply central bisq java conventions
2023-02-05 22:43:48 +00:00
Alejandro García
c61bd70ead
Merge pull request #6562 from alvasw/move_get_single_thread_executor_to_own_utils
Move SingleThreadExecutors to its own Utils class
2023-02-05 22:42:02 +00:00
Alva Swanson
53837bf00b
Move SingleThreadExecutors to its own Utils class 2023-02-05 22:11:35 +01:00
Alva Swanson
06f24a1b79
Connection: Call centralized thread pool shutdown await method 2023-02-05 22:10:43 +01:00
Alva Swanson
c1c4caf87f
Gradle: Apply bisq.java-conventions to all projects 2023-02-05 22:02:13 +01:00
Alva Swanson
7e984f86ca
Broadcaster: Shutdown executor 2023-02-05 13:38:50 +01:00
Alejandro García
8dbdecd6f1
Merge pull request #6549 from alvasw/fix_mailbox_message_service_thread_leak_explosion
Fix MailboxMessageService thread leak/explosion
2023-02-03 15:15:39 +00:00
Alva Swanson
10c46a3163
Fix MailboxMessageService thread leak/explosion
Each time when MailboxMessageService.onAdded(...) got called with
multiple mailbox entries a new thread got created. That thread was never
shutdown. This change explicitly creates a new Thread and sets its
result with a SettableFuture. After its computation the thread
terminates.
2023-01-31 17:02:09 +02:00
Alva Swanson
871656b18d
Make ProtoOutputStream thread-safe
Before SynchronizedProtoOutputStream created a new thread and made a
blocking call to ProtoOutputStream.writeEnvelope(...). Each connection
had an instance of SynchronizedProtoOutputStream, so we had a redundant
thread per connection. This change makes ProtoBufOutputStream
thread-safe and reduces the number of thread per connection as a
side effect.
2023-01-30 17:50:06 +02:00
Alejandro García
0a24f4c2d4
Merge pull request #6543 from alvasw/sychronized_proto_output_stream_try_graceful_shutdown_first
Sychronized proto output stream try graceful shutdown first
2023-01-28 19:24:32 +00:00
Alejandro García
b87de3dcbd
Merge pull request #6542 from alvasw/connection_close_proto_outputstream_before_socket
Connection: Close protoOutputStream before closing socket
2023-01-28 19:23:43 +00:00
Alva Swanson
7524425e74
SychronizedProtoOutputStream: Try graceful shutdown first
ProtoOutputStream is not thread-safe. This change tries to close the
stream on the same thread first. Before forcefully killing it after a
timeout.
2023-01-27 17:14:17 +02:00
Alva Swanson
9e8b54054a
Connection: Create shutdown timeout constant 2023-01-27 17:14:17 +02:00
Alva Swanson
e593adb602
Connection: Close protoOutputStream before closing socket
The protoOutputStream depends on the sockets OutputStream. Closing the
socket before closing the protoOutputStream will always trigger an
IOException.
2023-01-27 17:08:08 +02:00
Alva Swanson
6a8fb05156
Centralize all ExecutorService creations in Utilities 2023-01-27 16:15:24 +02:00
Alejandro García
d859f391bf
Merge pull request #6510 from HenrikJannsen/improve_connection_logs
Improvements in connection and increase timeout
2023-01-12 16:33:40 +00:00
Alejandro García
fda3c45008
Merge pull request #6501 from HenrikJannsen/always_include_high_prio_payload_in_get_data_response
Always include high prio payload in get data response
2023-01-12 16:33:08 +00:00
HenrikJannsen
ef7bb81b29
truncate logged proto
Signed-off-by: HenrikJannsen <boilingfrog@gmx.com>
2023-01-06 22:18:21 -05:00
HenrikJannsen
69b0bfa676
remove stacktrace
Signed-off-by: HenrikJannsen <boilingfrog@gmx.com>
2023-01-06 22:12:55 -05:00
HenrikJannsen
7a147ff9e8
Reduce log level
Signed-off-by: HenrikJannsen <boilingfrog@gmx.com>
2023-01-06 21:59:24 -05:00
HenrikJannsen
4888ae15ea
Truncate to length 15 instead of 10
Signed-off-by: HenrikJannsen <boilingfrog@gmx.com>
2023-01-06 21:13:37 -05:00
HenrikJannsen
1497b5ed6a
Add uid to thread name, shorten address in thread name
Signed-off-by: HenrikJannsen <boilingfrog@gmx.com>
2023-01-06 21:08:00 -05:00
HenrikJannsen
d3c573fc55
Add more detail logs
Signed-off-by: HenrikJannsen <boilingfrog@gmx.com>
2023-01-06 20:34:01 -05:00
HenrikJannsen
bdbb857c3f
Add more logs
Signed-off-by: HenrikJannsen <boilingfrog@gmx.com>
2023-01-06 20:00:43 -05:00
Alejandro García
6f8204a73a
Merge pull request #6506 from HenrikJannsen/update_BurningManAccountingStore
Update BurningManAccountingStore
2023-01-06 14:10:11 +00:00
HenrikJannsen
9fe3d22b24
Cleanup
Signed-off-by: HenrikJannsen <boilingfrog@gmx.com>
2023-01-05 22:23:24 -05:00
HenrikJannsen
719602358d
Increase pool size
Signed-off-by: HenrikJannsen <boilingfrog@gmx.com>
2023-01-05 22:17:09 -05:00
HenrikJannsen
31592ac955
Update BurningManAccountingStore
Signed-off-by: HenrikJannsen <boilingfrog@gmx.com>
2023-01-05 21:46:44 -05:00
HenrikJannsen
9deaa32df7
Disable tests for GetDataResponse
Sorry I don't have time atm to fix the complex tests. In the past the issues have always been caused by test setup issues and not because of introduced bugs.
Here we changed the algorithm for truncation, so that might be the case why it fails, or it is the new method for priority which might cause issues with the mocks.

Signed-off-by: HenrikJannsen <boilingfrog@gmx.com>
2023-01-05 11:39:28 -05:00
HenrikJannsen
33357cfc8d
Remove debug logs
Signed-off-by: HenrikJannsen <boilingfrog@gmx.com>
2023-01-05 00:27:29 -05:00
HenrikJannsen
7db8255e0b
Add GetDataResponsePriority for filtering payloads for GetDataResponse.
Fix sorting at truncating DateSortedTruncatablePayloads.
Rebroadcast high prio items
2023-01-04 23:55:47 -05:00
HenrikJannsen
1172eec2ce
Improve log
Signed-off-by: HenrikJannsen <boilingfrog@gmx.com>
2023-01-04 18:14:06 -05:00
HenrikJannsen
5efd13a678
Check if setException returns false and if so, cancel future.
Signed-off-by: HenrikJannsen <boilingfrog@gmx.com>
2023-01-04 18:09:04 -05:00
HenrikJannsen
5e29bfe4c2
Maintain pending futures and cancel them at cleanup.
Signed-off-by: HenrikJannsen <boilingfrog@gmx.com>
2023-01-04 14:01:54 -05:00
HenrikJannsen
3e48956227
Increase numOfFailedBroadcasts at timeout
Signed-off-by: HenrikJannsen <boilingfrog@gmx.com>
2023-01-04 14:01:54 -05:00
HenrikJannsen
de32339926
Remove stop setter at cancel
Signed-off-by: HenrikJannsen <boilingfrog@gmx.com>
2023-01-04 14:01:53 -05:00
HenrikJannsen
20b39a4055
Do not send close message to banned node
Signed-off-by: HenrikJannsen <boilingfrog@gmx.com>
2023-01-04 14:01:53 -05:00
HenrikJannsen
41fb5e464c
Use AtomicBoolean for stopped and timeoutTriggered
Signed-off-by: HenrikJannsen <boilingfrog@gmx.com>
2023-01-04 14:01:53 -05:00
HenrikJannsen
b7d1a9da22
Increase thread pool size at Broadcaster
Signed-off-by: HenrikJannsen <boilingfrog@gmx.com>
2023-01-03 19:58:29 -05:00
HenrikJannsen
d5b4ce275b
Add support for listeners when GetDataResponse and GetBlocksResponse are sent.
Signed-off-by: HenrikJannsen <boilingfrog@gmx.com>
2022-12-27 17:54:08 -05:00
HenrikJannsen
1030f891b9
Improve/cleanup logs.
Only log lostAllConnections after numOnConnections > 2 to avoid logs at startup

Signed-off-by: HenrikJannsen <boilingfrog@gmx.com>
2022-12-27 17:54:08 -05:00
HenrikJannsen
a8a0c0e725
Add custom thread pool to broadcaster
The broadcasting consumes most of the threads but has lower priority than other messages being sent.
By separating that thread pool from the common sendMessage executor we can reduce the risk that a burst of
broadcasts exhausts the thread pool and might drop send message tasks.

Signed-off-by: HenrikJannsen <boilingfrog@gmx.com>
2022-12-27 17:33:39 -05:00
HenrikJannsen
d5b65fe239
Reduce keepAliveTime to 30 sec.
Signed-off-by: HenrikJannsen <boilingfrog@gmx.com>
2022-12-27 17:31:07 -05:00
HenrikJannsen
7953e35395
Add executor parameter to sendMessage
Add try/catch to handle RejectedExecutionException

Signed-off-by: HenrikJannsen <boilingfrog@gmx.com>
2022-12-27 17:13:13 -05:00
HenrikJannsen
4a72c27fa0
Increase queue capacity from 10 to 30.
https://github.com/bisq-network/bisq/issues/6480 reported reaching the limit with the current settings.

Signed-off-by: HenrikJannsen <boilingfrog@gmx.com>
2022-12-22 08:46:02 +01:00
HenrikJannsen
30afccb2d6
Use ThreadPoolExecutor with custom set queueCapacity instead of CachedThreadPool
The previously used newCachedThreadPool carries higher risk for execution exceptions if exceeded.

Originally we had only one executor with a corePoolSize of 15 and a maximumPoolSize of 30 and queueCapacity was set to maximumPoolSize.
This was risky when the 15 corePool threads have been busy and new messages or connection creation threads are
queued up with potentially significant delay until getting served leading to timeouts.
Now we use (if maxConnections is 12) corePoolSize of 24, maximumPoolSize 36 and queueCapacity 10. This gives
considerable headroom. We also have split up the executors in 2 distinct ones.

Signed-off-by: HenrikJannsen <boilingfrog@gmx.com>
2022-12-19 16:50:55 +01:00
HenrikJannsen
1b182743a2
Update BurningManAccountingStore_BTC_MAINNET
Signed-off-by: HenrikJannsen <boilingfrog@gmx.com>
2022-12-19 09:31:58 +01:00
HenrikJannsen
2f9f66280a
Remove try catch. Will be handled in Future fault handler
Signed-off-by: HenrikJannsen <boilingfrog@gmx.com>
2022-12-19 09:31:55 +01:00
HenrikJannsen
ddf5239800
Increase timeouts from 3 to 4 min.
Signed-off-by: HenrikJannsen <boilingfrog@gmx.com>
2022-12-19 09:27:44 +01:00
HenrikJannsen
6aad3a8dc5
Reduce getDataResponse size from 9 MB to 6 MB
Reduce number of blocks at GetBlocksResponse from 4000 to 3000

Signed-off-by: HenrikJannsen <boilingfrog@gmx.com>
2022-12-19 09:27:27 +01:00
Christoph Atteneder
2b77f777a3
Update data stores for v1.9.7 2022-12-14 11:13:23 +01:00
Christoph Atteneder
5dea677644
Merge pull request #6459 from HenrikJannsen/handle_exception_at_send
Handle exception at send
2022-12-14 10:20:07 +01:00
Christoph Atteneder
71d6e126dd
Merge pull request #6423 from HenrikJannsen/add-burningman-accounting
Add burningman accounting
2022-12-14 10:17:38 +01:00
HenrikJannsen
8c65da9c85
Add thread index format
Add name param to newCachedThreadPool

Signed-off-by: HenrikJannsen <boilingfrog@gmx.com>
2022-12-13 20:35:49 -05:00
HenrikJannsen
fc2f9241b8
Apply codacy complaint
Signed-off-by: HenrikJannsen <boilingfrog@gmx.com>
2022-12-13 20:30:41 -05:00
HenrikJannsen
ebb6652cef
Remove restartTor method as restart is not supported anymore.
Signed-off-by: HenrikJannsen <boilingfrog@gmx.com>
2022-12-13 18:15:23 -05:00
HenrikJannsen
c000d38a09
Remove unnecessary thread and try/catch.
Wrap nodeAddressProperty.set into UserThread.execute as it is a javafx api. We call startServer also in that execute scope to maintain order of calls.

Signed-off-by: HenrikJannsen <boilingfrog@gmx.com>
2022-12-13 18:11:49 -05:00
HenrikJannsen
04a1dee9e9
Cleanup
Signed-off-by: HenrikJannsen <boilingfrog@gmx.com>
2022-12-13 18:07:01 -05:00
HenrikJannsen
6d2bd9f8d4
Use 3 distinct executors for send message, create connection and server.
Signed-off-by: HenrikJannsen <boilingfrog@gmx.com>
2022-12-13 18:03:29 -05:00
HenrikJannsen
c4dfc2f9ac
Add ExecutorService to TorNetworkNode instead of using pool from base class.
Remove torStartupFuture as it was not needed.
Make executorService private and add shutdownNow call.

Signed-off-by: HenrikJannsen <boilingfrog@gmx.com>
2022-12-13 17:57:19 -05:00
HenrikJannsen
0e34932ec8
Remove createExecutorService method and create executor in constructor instead.
Make executorService protected final

Signed-off-by: HenrikJannsen <boilingfrog@gmx.com>
2022-12-13 17:53:03 -05:00
HenrikJannsen
553dd84f28
Cleanups
Signed-off-by: HenrikJannsen <boilingfrog@gmx.com>
2022-12-13 17:49:51 -05:00
HenrikJannsen
43233db70c
Throw RuntimeException at sendMessage.
Make sendMessage package scope to not be used from client code.
Remove stacktrace print.

The caller in NetworkNode would report a onSuccess in the future callback because we do not escalate the exception but only handle it inside handleException.

Signed-off-by: HenrikJannsen <boilingfrog@gmx.com>
2022-12-13 17:47:04 -05:00
HenrikJannsen
f90c4b8f6b
Use cachedThreadPool which uses SynchronousQueue instead of ArrayBlockingQueue.
When ArrayBlockingQueue is used (as in case of using Utilities.getListeningExecutorService) the maxPoolSize
has no effect. The pool creates never more threads than the core pool size.
Thus we have been limited to 15 threads for message sending and connection creation.
This was likely a reason why seed nodes are not accepting new connections if the pool is exhausted.
Slow message send can block a thread for 1-3 minutes.

Signed-off-by: HenrikJannsen <boilingfrog@gmx.com>
2022-12-13 17:33:31 -05:00
HenrikJannsen
0dc8d0b2bd
Add maxConnection parameter to be used for setting the core pool size of the executor in NetworkNode.
We use double the maxConnection size for the core size and 4x for the max pool size.

Signed-off-by: HenrikJannsen <boilingfrog@gmx.com>
2022-12-13 16:35:16 -05:00
HenrikJannsen
1e32d86b23
Only log errors if shutdown is not in progress.
I want to avoid to risk changes with not calling error handlers/listeners in those cases
as not 100% sure if that could have unintended effects.

Signed-off-by: HenrikJannsen <boilingfrog@gmx.com>
2022-12-11 17:08:40 -05:00
HenrikJannsen
1bb4b55220
Add BurningManAccountingStore resource file.
Use resourceDataStoreService and extend StoreService

Signed-off-by: HenrikJannsen <boilingfrog@gmx.com>
2022-12-11 11:15:18 -05:00
HenrikJannsen
3caf2c2b64
Change visibility (will be used from monitor project).
Remove log, change log level.
Add getters

Signed-off-by: HenrikJannsen <boilingfrog@gmx.com>
2022-12-07 11:50:24 -05:00
Alejandro García
e054083c1f
Merge pull request #6376 from jmacxx/fix_issue_6367
Fix loss of mailbox messages during SPV resync
2022-11-29 14:41:27 +02:00
sqrrm
b10881ff7f
Merge pull request #6418 from HenrikJannsen/improve-dao-node-domain
Improve dao node domain
2022-11-26 16:19:52 +01:00
jmacxx
8a94642e1a
Do not erase mailbox messages during SPV resync. 2022-11-25 21:13:09 -06:00
Alejandro García
a6293a64cb
Merge pull request #6396 from jmacxx/show_commit_hash
Store the build's commit hash in Jarfile manifest
2022-11-25 17:36:34 +02:00
HenrikJannsen
ffd2cc1a8c
Handle nullable case caused by tests
Add mock to test.

Signed-off-by: HenrikJannsen <boilingfrog@gmx.com>
2022-11-24 19:47:55 -05:00
HenrikJannsen
2de86222b7
Do not apply large persisted messages
Signed-off-by: HenrikJannsen <boilingfrog@gmx.com>
2022-11-24 13:36:47 -05:00
HenrikJannsen
143af43eba
Remove log level change for tor at startup
Signed-off-by: HenrikJannsen <boilingfrog@gmx.com>
2022-11-23 19:53:40 -05:00
HenrikJannsen
96ea154176
Rename delegate to outputStream
Signed-off-by: HenrikJannsen <boilingfrog@gmx.com>
2022-11-23 19:53:12 -05:00
HenrikJannsen
86723cf85a
Improve logging, cleanups
Signed-off-by: HenrikJannsen <boilingfrog@gmx.com>
2022-11-23 19:52:35 -05:00
HenrikJannsen
32f2f0ab76
Improve logging of persisted mailbox messages
Signed-off-by: HenrikJannsen <boilingfrog@gmx.com>
2022-11-23 19:51:23 -05:00
HenrikJannsen
91c25f8aa5
Limit getDataResponse to 90% of MAX_PERMITTED_MESSAGE_SIZE (10MB)
Allocate 25% of the space for PersistableNetworkPayloads and 75% for ProtectedStorageEntries

Signed-off-by: HenrikJannsen <boilingfrog@gmx.com>
2022-11-23 16:03:59 -05:00
HenrikJannsen
671ab1f373
Cleanup
Improve toString methods

Signed-off-by: HenrikJannsen <boilingfrog@gmx.com>
2022-11-17 19:55:04 -05:00
HenrikJannsen
de654c15b3
Improve handling of ConnectionState.expectedInitialDataResponses
Rename to expectedInitialDataResponses as we compare with numInitialDataResponses.
Add comment to make it more clear how its used.
Let the LiteNode increment only if getBlocks get called (e.g. blocks are missing).

Signed-off-by: HenrikJannsen <boilingfrog@gmx.com>
2022-11-17 19:41:32 -05:00
jmacxx
bc8b05ea45
Log readability will be improved by lowering to trace the repetitive
logging of: `The requester had version x.x.x.  Our historical data
store has version y.y.y  As the requester version is not older as our
historical store we do not add the data to the result map.`
Which takes up many screenfuls of log for every client getDataRequest.
2022-10-31 10:46:12 -05:00