-
Notifications
You must be signed in to change notification settings - Fork 38.7k
SIGUSR1 new block notifications #555
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
Conversation
|
Does this work on Windows? |
|
Better question - does this even compile on Windows? |
|
Good question. No idea. I don't use Windows... Anyone want to step up to test, or should I resubmit this with non-Windows #ifdefs? |
|
I didn't think there was such a thing as SIGUSR1 on windows. Whilst this is the current implementation many pushpool pools use now it has a couple of limitations that are relevant to pools and some extras that are specific to java based pools (i.e. poolserverj). 1/ it requires the pool engine to be on the same machine as the bitcoin daemon The principal is good and definitely desirable from a pool engine's perspective, it's just the method of sending the signal that is limiting. poolserverj currently uses an intermediary mini-daemon (written in C) that listens for signals then sends a signal over a network socket. This is a very simple but custom protocol. Open socket, send a \n terminated string [passphrase]:[bitcoind id string] then close socket. This is pretty hackish so I'd be open to an alternative but I think a network based notification method would be preferable for the above reasons. perhaps in keeping with the json-rpc trend |
|
I do think bitcoin needs a mechanism to send asynchronous notifications of incoming transactions, new blocks, whatever a client wants to subscribe to. However, I agree with @shadders, and don't think signals are the preferred interprocess communication method here. Signals are specific to UNIX and pretty annoying to handle at that, as they interrupt system calls, and have many other tricky corner cases. |
|
How about dbus? |
|
Dbus is a desktop technology. This would primarily be used on servers... |
|
DBUS, featurewise would be exactly what we need here. It supports both However it also has some drawbacks:
There is a large compatiblility argument for "Keeping it HTTP" here. On the Any ideas? :-) On Fri, Oct 14, 2011 at 7:12 AM, Luke-Jr <
|
|
I completely agree with luke here. DBus really isnt the best choice here, primarily because it is really mostly used as a desktop technology. Additionally, does java have a good DBus library? One of the complaints about sending a USR1 signal was poor java support therefor. Although this is largely platform-specific (again, does this compile on windows?) I would say this, it is still worth merging. "Wladimir J. van der Laan" [email protected] wrote:
|
|
How about the callback URL's then? |
|
At that point its getting much too complicated for what it is designed to do. |
|
They don't have to be exclusive, either... |
|
True, though I would really prefer to KISS here instead of implementing a large new addition for such a simple feature. |
|
why does it have to be one or other? I callback side by side with a If you want to wrap sigusr you are limited in the languages you can use On 15/10/11 01:28, Matt Corallo wrote:
|
|
it's not exactly complicated... a http call. And if the framework is in On 15/10/11 01:37, Matt Corallo wrote:
|
|
This may be something more thorough than what is needed, but some sort of hooks "interface" like @laanwj was saying, for events like new transactions, blocks, etc is much needed. I imagine something flexible like being able to specify in the conf file an event and a script to run or a callback URL to POST to. |
|
I think a script call would be just as usable as a callback url. A On 15/10/11 01:44, freewil wrote:
|
|
Yup, what @shadders says. A script to run (probably passed some helpful arguments) or a callback URL I think gives the best flexibility. |
|
Yes a callback script or URL would have my preference for now. This could do |
|
Gavin had some ideas about a similar topic way back here: #20 I also agree that doing things non-portably (such as via SIGUSR1, as proposed) isn't the right way to go. If a stopgap is needed prior to a full JSON-RPC callback implementation, I'd suggest something like simply writing the new block's hash to a file that can act as a semaphore. Other programs could just stat() this file periodically for its last update time, as a simple IPC. |
|
A lot of talk as if this is merely a proposed thing, but it's in fact the de-facto standard for pretty much every longpoll-enabled miner. |
|
That's a polling not push. The fallback mechanism for 'listeners' that On 15/10/11 05:55, Mike Gogulski wrote:
|
|
The ideal solution would probably be native longpolling in bitcoind. The file-based mechanism would be push, if you use inotify to monitor it for changes ;) |
|
Not the case. Poolserverj is now used by 2 of the 4 largest pools + In terms of backward compatibility and script to send the same signal is On 15/10/11 06:37, Luke-Jr wrote:
|
|
On 15/10/11 10:00, Luke-Jr wrote:
//inotify/ is a Linux kernel subsystem that acts to extend filesystems Do you see the problem here? |
|
Suggestion: resolving/merging this should have the lowest possible priority. Why? It benefits ~2 dozen pool operators. Dev attention is far better (as in by orders or magnitude) spent on improving the end-user experience and extending capabilities for commerce. Alternately, surround the relevant code with "#ifdef poold" or something, pull it, and let pool operators build their own. Case closed, on to more important things. |
|
To suggest that needs of pool operators are unimportant because there Furthermore the change does not benefit just the pool operators it No one is asking anyone who doesn't care to do anything. This On 15/10/11 17:00, Mike Gogulski wrote:
|
|
p.s. since commerce capabilities meet your classification of 'important' On 15/10/11 17:00, Mike Gogulski wrote:
|
|
I agree with shadders - the "lowest possible priority" thing is just an obvious misunderstanding of the concept - the IPC code, if implemented correctly, could give benefits to all bitcoind admins - making Bitcoin e-commerce easier. |
|
Shadders, I consider it a non-issue that Java is too broken to support standard POSIX functionality. Lack of Windows support for SIGUSR1 specifically is also arguably a non-issue, since nobody sane runs servers on Windows anyway-- I suppose I need to add some #ifdefs though. If people actually need something like this on Windows, I'm sure it has some non-standard equivalent too. |
|
"IPC code, if implemented correctly, could give benefits to all bitcoind admins" No, only to those running bitcoind on the very same machine as their commerce app/pool server -- or running such an app at all. RPC solves the general case, and those running both on the same box can point to localhost. @shadders: Did you actually read issue 20? |
|
Here is gaven's actually work on this, it's probably outdated, but something like this - added with the option of running a script also would solve the problem and make everyone happy I think. |
|
On 16/10/11 04:09, Mike Gogulski wrote:
Unfortunately that's only true in luke's happy place where JVMs don't />>> Shadders, I consider it a non-issue that Java is too broken to support standard POSIX functionality. / Luke currently 75% of network hash power is served by pools that use a There are two solutions presented here that are both simple to implement |
|
Please explain how SIGUSR1 notifications (the topic here) have anything to do with your far more complicated solutions. It's my understanding that your ideas are not in any way exclusive or broken by getting this simple implementation in. |
I think the goal should be to not include quick solutions like this for every single need in the official release. IMO a far more flexible and comprehensive (therefore superior) solution has been proposed. |
|
"Superior" can be based on a lot of different things. Every other proposed solution requires significantly more code and CPU time to implement, whereas this is a simple standard solution to a simple problem. |
If you were able to specify a script/executable to be called upon a "newblock" event, and that script/executable simply created the same signal, would this really take up so much more cpu time to be detrimental? |
|
On 16/10/11 11:15, Luke-Jr wrote:
Aside from that it's simple politics. Once you implement a 1/2 arsed You're calling these complicated solutions but I honestly can't see Why is executing an external script so complex for this application when As I've said if SIGUSR1 is important to you there's no reason you Let me break it down for you... SIGUSR1:
Script/RPC
|
|
Unlikely. I've never used coinbaser's TCP mode outside of testing, simply because popen wasn't a bottleneck ;) |
|
By complex, I was mainly referring to JSON/HTTP-based solutions, which require an implementation of both of those specs-- neither part of the common C standard. As implied, I did implement TCP support into coinbaser because of the possibility of overhead from executing an external script. I also found it wasn't an issue, so never ported my Eligius code to make use of it. I can also see and agree that most pools, even pushpool-based, could benefit greatly from a coinbaser-like system/popen solution rather than SIGUSR1-- their script could send the signal and then start work on processing payouts. If someone wishes to implement the system/popen solution (really will probably be a fork-and-exec so it can be a simple fire-off), I'd be glad to close this in favour of merging that. Not much difference between -blknotifypidfile=foo.pid and -blknotify='kill -USR1 $(<foo.pid)' |
|
SIGUSR1 is an ugly hack on pushpool's part. However, it is also very simple and straightforward. With more complex solutions stalled, I think pragmatism says it would be OK to merge this with some minor changes:
|
|
Superceded with pull #714 |
Fix potential deadlock - cs_xval
P2P - Feature Bits
-blknotifypidfile option to send SIGUSR1 to a PID when there's a new best block
Used by basically every pool now, it just sends SIGUSR1 to a poolserver.