-
Notifications
You must be signed in to change notification settings - Fork 381
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[QUESTION] Why do process handles keep increasing. #185
Comments
Hey @yjs112233 CliClient is designed to be used from the command line, not programatically. The runtime shutdown is disabled: bt/bt-cli/src/main/java/bt/cli/CliClient.java Line 139 in 7a141ed
Is there a reason why you're using the CliClient class rather than directly integrating with BtClient/BtRuntime? |
Thank you very much for paying attention to this problem that has bothered me for several months.
Here is my BtClient configuration:
At first everything was normal. And it can support multiple tasks at the same time. |
I use BT version 1.9 from maven repository, the self-contained org. Eclipse. Jetty is excluded. And additional integration with org.eclipse.jetty version: 8.2.0.v20160908; |
Sorry, it's not entirely clear from your message -- is there only one
instance of runtime/client active at each given time? I.e. are you saying
that the runtime leaves files/connections open after having shut down?
Because in the case of multiple runtimes/clients you can easily hit the OS
limit on the number of simultaneously open file descriptors and will have
to increase this limit or re-think your application's pipeline.
…On Tue, 5 Oct 2021, 14:58 yjs112233, ***@***.***> wrote:
I use BT version 1.9 from maven repository, the self-contained org.
Eclipse. Jetty is excluded. And additional integration with
org.eclipse.jetty version: 8.2.0.v20160908;
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#185 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AA4TJBVP5D3LO4QNGHPBYILUFLY6FANCNFSM5CTTJWNQ>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
is there only one instance of runtime/client active at each given time? End: After running some torrent files like this, and wait until all BtRuntime instance has been closed, A large number of connections were found in CLOSE_WAIT state. If more torrent files are run, the application will throw too many open files. |
If this is the case, using the latest snapshot build should fix your issue. Looking through the code briefly, I noticed the following
Neither of these address your issue, but they probably should be fixed. I would suggest as a next step to better understand this issue
|
thanks ! |
Hi!I am back. |
Excellent (:
Can you explain why you have this use case? Why do you want to download a torrent multiple times in the same runtime? From a protocol perspective, this can't be implemented because if an incoming peer connects to the torrent, the runtime won't know which instance to associate it with. |
If BT is used as an service, two different people may want to download the same Torrent and it may happen at the same time. |
There are two solutions that I see for this use case.
The second solution is technically superior, but more coding, and some bt changes. If there are additional tracker(s) (announce/announce-list) in the torrent loaded second, those should be somehow added to the torrent which is downloading. Some of the work has been done for this Note, this second solution won't work properly with private trackers that track download/upload amounts because they often put a unique identifier in the announce url. |
Thank you for helping me solve these lssues ! |
Sure 👍 |
Another way would be to implement a storage that can be re-used by
concurrent users without having to create a new BtClient instance. E.g.
sharing a single storage among multiple user requests.
…On Wed, 13 Oct 2021, 09:29 pyckle, ***@***.***> wrote:
Sure 👍
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#185 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AA4TJBXFYBSG6SALSUFSZXTUGUYOFANCNFSM5CTTJWNQ>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
Hooking a new client for a torrent that already exists in the shared
runtime does not make sense to me at all.
On Wed, 13 Oct 2021, 16:22 Andrei Tomashpolskiy, ***@***.***>
wrote:
… Another way would be to implement a storage that can be re-used by
concurrent users without having to create a new BtClient instance. E.g.
sharing a single storage among multiple user requests.
On Wed, 13 Oct 2021, 09:29 pyckle, ***@***.***> wrote:
> Sure 👍
>
> —
> You are receiving this because you commented.
> Reply to this email directly, view it on GitHub
> <#185 (comment)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AA4TJBXFYBSG6SALSUFSZXTUGUYOFANCNFSM5CTTJWNQ>
> .
> Triage notifications on the go with GitHub Mobile for iOS
> <https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
> or Android
> <https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
>
>
|
Perhaps I misread the code, but I don't think that would work well, unless the download has finished. If the download hasn't finished, both runtimes will try and write the same unfinished blocks because they have no idea which blocks the other has downloaded, and when to has them. If there's content poisoning/a peer happens to send a corrupted chunk of data, one runtime could ban a good peer because the other runtime wrote a bad piece. Also, one runtime, unaware that data has been corrupted could send out bad data. |
What you say only applies in the presence of multiple clients but my point
is that there's usually no need to have more than one client for each
torrent. The storage by itself is an interface that can be re-used for
relaying and/or accessing the data downloaded by the first (and only)
client without having to create a dedicated client. Maybe I don't
understand the use case? E.g. if we're talking about a media streaming
service that is "backed" exclusively by torrent swarms (i.e. a purely
transient proxy that only relays data from peers to end users and does not
have its' own storage capacity in any significant quantity), then it's
going to be an operational model that is very different from the original
protocol intentions and design so an efficient implementation will have to
make quite a few changes to an off-the-shelf torrent client. Maybe it's
possible to approximate such an implementation to some extent with a couple
of crutches in the existing code but it would still be very inferior to one
that is built from the ground up with the concept of efficient transient
proxying in mind. On the other hand, if there is some reasonable storage
capacity then this problem can be pretty much solved without having to
change a single line of code in an off-the-shelf torrent client (be it Bt
or any other implementation).
ср, 13 окт. 2021 г. в 22:50, pyckle ***@***.***>:
… Another way would be to implement a storage that can be re-used by
concurrent users without having to create a new BtClient instance.
Perhaps I misread the code, but I don't think that would work well, unless
the download has finished. If the download hasn't finished, both runtimes
will try and write the same unfinished blocks because they have no idea
which blocks the other has downloaded, and when to has them. If there's
content poisoning/a peer happens to send a corrupted chunk of data, one
runtime could ban a good peer because the other runtime wrote a bad piece.
Also, one runtime, unaware that data has been corrupted could send out bad
data.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#185 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AA4TJBXVEAIGGAKQFIVRDM3UGXWILANCNFSM5CTTJWNQ>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
In other words, there are two main types of peers in Bittorrent:
- (full) seeds, who have all of the data in a controlled storage, can exist
indefinitely long and are able to service all incoming requests
- leeches, who only have a subset of data, exist only while their data is
incomplete and are able to service only requests for the data that they
have; when they finally have all of the data, they either cease to exist or
become seeds
Also there is a special case of partial seeds but the only difference with
full seeds is in the subset of data that they explicitly indicate they have.
Does OP's mode of operation correspond to something of the above or is it
something else, like a quasi-seed that indicates to have all of the data
but actually proxyies all requests to actual seeds in the swarm?
…On Thu, 14 Oct 2021, 01:14 Andrei Tomashpolskiy, ***@***.***> wrote:
What you say only applies in the presence of multiple clients but my point
is that there's usually no need to have more than one client for each
torrent. The storage by itself is an interface that can be re-used for
relaying and/or accessing the data downloaded by the first (and only)
client without having to create a dedicated client. Maybe I don't
understand the use case? E.g. if we're talking about a media streaming
service that is "backed" exclusively by torrent swarms (i.e. a purely
transient proxy that only relays data from peers to end users and does not
have its' own storage capacity in any significant quantity), then it's
going to be an operational model that is very different from the original
protocol intentions and design so an efficient implementation will have to
make quite a few changes to an off-the-shelf torrent client. Maybe it's
possible to approximate such an implementation to some extent with a couple
of crutches in the existing code but it would still be very inferior to one
that is built from the ground up with the concept of efficient transient
proxying in mind. On the other hand, if there is some reasonable storage
capacity then this problem can be pretty much solved without having to
change a single line of code in an off-the-shelf torrent client (be it Bt
or any other implementation).
ср, 13 окт. 2021 г. в 22:50, pyckle ***@***.***>:
> Another way would be to implement a storage that can be re-used by
> concurrent users without having to create a new BtClient instance.
>
> Perhaps I misread the code, but I don't think that would work well,
> unless the download has finished. If the download hasn't finished, both
> runtimes will try and write the same unfinished blocks because they have no
> idea which blocks the other has downloaded, and when to has them. If
> there's content poisoning/a peer happens to send a corrupted chunk of data,
> one runtime could ban a good peer because the other runtime wrote a bad
> piece. Also, one runtime, unaware that data has been corrupted could send
> out bad data.
>
> —
> You are receiving this because you commented.
> Reply to this email directly, view it on GitHub
> <#185 (comment)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AA4TJBXVEAIGGAKQFIVRDM3UGXWILANCNFSM5CTTJWNQ>
> .
> Triage notifications on the go with GitHub Mobile for iOS
> <https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
> or Android
> <https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
>
>
|
Perhaps my incomplete description misled you, I actually isolated the different BtRuntime downloads by setting different storage locations. So there is no block collision. |
[describe]
--version , demo download from this.
--start from bt.cli.CliClient.
--After running multiple instances[new CliClient()] in the same process and all in shutdown, the handle still exists. Maybe somewhere forgot to close stream.
--other. A large number of connections were found in CLOSE_WAIT state.
If this is a problem, how can I solve it to keep the program running consistently?
Thanks.
The text was updated successfully, but these errors were encountered: