Bitcoin Forum
May 04, 2024, 03:48:46 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Poll
Question: Would you use such a mining proxy?  (Voting closed: April 13, 2011, 10:26:05 PM)
Yes, it seems like a good idea. - 7 (63.6%)
Maybe. - 1 (9.1%)
No, I don't like the idea. - 3 (27.3%)
No, I use something similar already. - 0 (0%)
Total Voters: 11

Pages: « 1 [2] 3 4 5 6 7 8 9 10 11 12 13 14 15 16 »  All
  Print  
Author Topic: Flexible mining proxy  (Read 88553 times)
BitLex
Hero Member
*****
Offline Offline

Activity: 532
Merit: 505


View Profile
May 06, 2011, 04:52:28 AM
 #21

i only get an xml-parsing error when trying to access /admin/
Code:
XML Parsing Error: XML or text declaration not at start of entity
Location: http://blah/admin/
Line Number 2, Column 1:<?xml version="1.0" encoding="UTF-8"?>

guess it's just a blank line hiding somewhere, but i can't find it.

1714794526
Hero Member
*
Offline Offline

Posts: 1714794526

View Profile Personal Message (Offline)

Ignore
1714794526
Reply with quote  #2

1714794526
Report to moderator
1714794526
Hero Member
*
Offline Offline

Posts: 1714794526

View Profile Personal Message (Offline)

Ignore
1714794526
Reply with quote  #2

1714794526
Report to moderator
1714794526
Hero Member
*
Offline Offline

Posts: 1714794526

View Profile Personal Message (Offline)

Ignore
1714794526
Reply with quote  #2

1714794526
Report to moderator
In order to achieve higher forum ranks, you need both activity points and merit points.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714794526
Hero Member
*
Offline Offline

Posts: 1714794526

View Profile Personal Message (Offline)

Ignore
1714794526
Reply with quote  #2

1714794526
Report to moderator
1714794526
Hero Member
*
Offline Offline

Posts: 1714794526

View Profile Personal Message (Offline)

Ignore
1714794526
Reply with quote  #2

1714794526
Report to moderator
pwnyboy
Full Member
***
Offline Offline

Activity: 125
Merit: 100


View Profile
May 06, 2011, 05:38:03 AM
 #22

If you run into any trouble, let me know.  I intend to support the software I publish.  (That goes for everyone.)

He is serious about this, worked with me on and off for a good hour helping me figure stuff out step by step.  Already made a small donation, well worth it.

Sweet!  Maybe you can advise on the following.  I broke down and decided to stay up past my bedtime to pull your code and put it online.  I took your advice and put this on a separate vhost in apache, because my mining client (phoenix) would not hit http://domain.com/some/big/url as you pointed out.  I threw this on a CentOS box that already has working php/mysql sites on it, so any dependencies other than those two are hopefully met already.  When I connect Phoenix, it tells me 'failed to connect, retrying'.  When I examine my apache error log, I see this:

[Fri May 06 01:30:05 2011] [error] [client xxx.113] PHP Notice:  Undefined index:  lpurl in /home/rrb/bitproxy/index.php on line 70
[Fri May 06 01:30:05 2011] [error] [client xxx.113] PHP Notice:  Undefined variable: http_response_header in /home/rrb/bitproxy/common.inc.php on line 117
[Fri May 06 01:30:05 2011] [error] [client xxx.113] PHP Warning:  Invalid argument supplied for foreach() in /home/rrb/bitproxy/index.php on line 215

Additionally, you might find this of interest.  When I hit the admin url, the admin interface seems to work fine but merely hitting /admin/ throws the following into the apache error log:

[Fri May 06 01:31:15 2011] [error] [client xxx.252] PHP Notice:  Undefined index:  format in /home/rrb/bitproxy/mvc.inc.php on line 38
[Fri May 06 01:31:15 2011] [error] [client xxx.252] PHP Notice:  Undefined index:  tempdata in /home/rrb/bitproxy/common.inc.php on line 177
[Fri May 06 01:31:15 2011] [error] [client xxx.252] PHP Notice:  Undefined index:  tempdata in /home/rrb/bitproxy/common.inc.php on line 177

(IPs redacted).  I'm pretty sure I followed your instructions to the letter, but have not yet taken a look at the code to try and debug this (maybe tomorrow).  Any ideas?
pwnyboy
Full Member
***
Offline Offline

Activity: 125
Merit: 100


View Profile
May 06, 2011, 07:32:12 AM
 #23

So insomnia set in, and I decided to dig deeper.  I found a couple more things:

1) In your database schema, in the worker_pool table, the type for the 'enabled' field is a tinyint and should be boolean it looks like, unless you have some special state info to store that's not 0 or 1?
2) I discovered #1 while attempting to go back and edit the workers and pool info that I'd setup the first time, in an effort to debug what was happening with the behavior I reported above.  While using the various "edit" dialogs, I'm hitting blank pages being returned, i.e. in the "edit pool" dialog at http://xxx/admin/pool.php?id=1&action=edit - it returns nothing in View Source as well. 

Having said that, and after editing the databases by hand (because it looks like I had the port number to the pool AND my login credentials entered incorrectly), I got further with the miner now (I'm guessing before it would not connect because the credentials at the pool were incorrect.  Here's what happens now: 

[06/05/2011 03:18:17] Connected to server
[06/05/2011 03:18:23] Disconnected from server
[06/05/2011 03:18:23] Result: 5b433c62 rejected
[06/05/2011 03:18:24] Connected to server
[06/05/2011 03:18:26] Disconnected from server
[06/05/2011 03:18:26] Result: 9e17d0db rejected
[06/05/2011 03:18:27] Connected to server
[06/05/2011 03:18:31] Disconnected from server

My first instinct was to turn on keepalives in the webserver, I did so and set them to allow an unlimited number with a 30 second timeout, but it only prolonged the generation of the same errors by 10 or 20 seconds.  In the end it still disconnected my client from the server.  I tried m0mchil's miner with similar results:

06/05/2011 03:25:22, Unexpected error:
Traceback (most recent call last):
  File "BitcoinMiner.pyo", line 141, in mine
  File "BitcoinMiner.pyo", line 168, in sendResult
  File "BitcoinMiner.pyo", line 177, in getwork
  File "BitcoinMiner.pyo", line 204, in request
TypeError: string indices must be integers
248779 khash/s

This after running 10 to 20 seconds also.  Not seeing anything in the logs that would give me any indication of the problem.  Without cranking up a sniffer, I'm out of ideas; any suggestions?
cdhowie (OP)
Full Member
***
Offline Offline

Activity: 182
Merit: 107



View Profile WWW
May 06, 2011, 11:25:36 AM
 #24

When I connect Phoenix, it tells me 'failed to connect, retrying'.  When I examine my apache error log, I see this:

[Fri May 06 01:30:05 2011] [error] [client xxx.113] PHP Notice:  Undefined index:  lpurl in /home/rrb/bitproxy/index.php on line 70
This notice is expected.  PHP likes to whine if you access array keys that aren't defined, but it's impractical to always check if they're set first.  Smiley

[Fri May 06 01:30:05 2011] [error] [client xxx.113] PHP Notice:  Undefined variable: http_response_header in /home/rrb/bitproxy/common.inc.php on line 117
This is a bit troubling, as $http_response_header is a reserved variable.  Which version of PHP are you using?  Did you make sure to enter "http://" at the beginning of each pool URL?  (Something like "deepbit.net:8332" will not work; you need "http://deepbit.net:8332".)  You may also get this error if the HTTP host can't be reached at all, for example due to a DNS lookup failure.

[Fri May 06 01:30:05 2011] [error] [client xxx.113] PHP Warning:  Invalid argument supplied for foreach() in /home/rrb/bitproxy/index.php on line 215
This is related to the previous issue; fixing it should make this one go away.

Additionally, you might find this of interest.  When I hit the admin url, the admin interface seems to work fine but merely hitting /admin/ throws the following into the apache error log:

[Fri May 06 01:31:15 2011] [error] [client xxx.252] PHP Notice:  Undefined index:  format in /home/rrb/bitproxy/mvc.inc.php on line 38
[Fri May 06 01:31:15 2011] [error] [client xxx.252] PHP Notice:  Undefined index:  tempdata in /home/rrb/bitproxy/common.inc.php on line 177
[Fri May 06 01:31:15 2011] [error] [client xxx.252] PHP Notice:  Undefined index:  tempdata in /home/rrb/bitproxy/common.inc.php on line 177
Yes, this is PHP being picky again.  You can ignore these.  Smiley

1) In your database schema, in the worker_pool table, the type for the 'enabled' field is a tinyint and should be boolean it looks like, unless you have some special state info to store that's not 0 or 1?
MySQL does not have a real boolean type; BOOLEAN is an alias for TINYINT(1).

2) I discovered #1 while attempting to go back and edit the workers and pool info that I'd setup the first time, in an effort to debug what was happening with the behavior I reported above.  While using the various "edit" dialogs, I'm hitting blank pages being returned, i.e. in the "edit pool" dialog at http://xxx/admin/pool.php?id=1&action=edit - it returns nothing in View Source as well.
Hmm, this is almost certainly a bug.  Can you edit other pools, or is it just this one?  Does anything show up in the Apache logs when you hit this page?

Having said that, and after editing the databases by hand (because it looks like I had the port number to the pool AND my login credentials entered incorrectly), I got further with the miner now (I'm guessing before it would not connect because the credentials at the pool were incorrect.  Here's what happens now: 

[06/05/2011 03:18:17] Connected to server
[06/05/2011 03:18:23] Disconnected from server
[06/05/2011 03:18:23] Result: 5b433c62 rejected
[06/05/2011 03:18:24] Connected to server
[06/05/2011 03:18:26] Disconnected from server
[06/05/2011 03:18:26] Result: 9e17d0db rejected
[06/05/2011 03:18:27] Connected to server
[06/05/2011 03:18:31] Disconnected from server

My first instinct was to turn on keepalives in the webserver, I did so and set them to allow an unlimited number with a 30 second timeout, but it only prolonged the generation of the same errors by 10 or 20 seconds.  In the end it still disconnected my client from the server.  I tried m0mchil's miner with similar results:

06/05/2011 03:25:22, Unexpected error:
Traceback (most recent call last):
  File "BitcoinMiner.pyo", line 141, in mine
  File "BitcoinMiner.pyo", line 168, in sendResult
  File "BitcoinMiner.pyo", line 177, in getwork
  File "BitcoinMiner.pyo", line 204, in request
TypeError: string indices must be integers
248779 khash/s

This after running 10 to 20 seconds also.  Not seeing anything in the logs that would give me any indication of the problem.  Without cranking up a sniffer, I'm out of ideas; any suggestions?
This is definitely weird.  I use poclbm without any issues, so you should be able to use it too.  I'm mostly worried about the rejected shares in the first example.  Were all shares rejected or just those two?

Using a sniffer might be a good idea, since it's hard to tell just from these logs exactly what's going wrong.

Tips are always welcome and can be sent to 1CZ8QgBWZSV3nLLqRk2BD3B4qDbpWAEDCZ

Thanks to ye, we have the final piece.

PGP key fingerprint: 2B7A B280 8B12 21CC 260A  DF65 6FCE 505A CF83 38F5

SerajewelKS @ #bitcoin-otc
cdhowie (OP)
Full Member
***
Offline Offline

Activity: 182
Merit: 107



View Profile WWW
May 06, 2011, 11:30:30 AM
 #25

i only get an xml-parsing error when trying to access /admin/
Code:
XML Parsing Error: XML or text declaration not at start of entity
Location: http://blah/admin/
Line Number 2, Column 1:<?xml version="1.0" encoding="UTF-8"?>

guess it's just a blank line hiding somewhere, but i can't find it.
Yeah, there's definitely a blank line being output prior to the XML header.  I don't see the same behavior on my install, in fact the dashboard validates as XHTML strict (as should every other page, but I just checked the dashboard right now and it validates).  I can't find anywhere in the code where the blank line would be getting written.

Tips are always welcome and can be sent to 1CZ8QgBWZSV3nLLqRk2BD3B4qDbpWAEDCZ

Thanks to ye, we have the final piece.

PGP key fingerprint: 2B7A B280 8B12 21CC 260A  DF65 6FCE 505A CF83 38F5

SerajewelKS @ #bitcoin-otc
pwnyboy
Full Member
***
Offline Offline

Activity: 125
Merit: 100


View Profile
May 06, 2011, 11:33:50 PM
Last edit: May 07, 2011, 01:52:37 AM by pwnyboy
 #26

Thanks for the replies.  I should start by saying that I think those errors I was seeing in the errorlog were related to my incorrect entering of the parameters for deepbit (username/password, and the port number).  Although I did have it entered in the correct format as you mentioned.  In a future version you might want to do some more extensive error handling to let the user know in the admin panel that the "last result" from the pool is that it can't connect because of x or y, and the actual error sent back from the pool was z.

I sniffed out the communication going from Phoenix to the proxy only, and this is what it looks like (including timestamps above):

1) Initial connection:

19:14:20.136363
POST / HTTP/1.1
Connection: close
Content-Length: 44
Host: bitproxy.xxx.com
Content-Type: application/json
Authorization: Basic xxx
User-Agent: phoenix/v1.2

{"method": "getwork", "params": [], "id": 1}

2) One more (not sure why this was necessary):

19:14:20.693905
POST / HTTP/1.1
Connection: close
Content-Length: 44
Host: bitproxy.xxx.com
Content-Type: application/json
Authorization: Basic xxx
User-Agent: phoenix/v1.2

{"method": "getwork", "params": [], "id": 1}

3) Another for long polling?:

19:14:20.717374
GET /index.php?lpurl=http%3A%2F%2Fdeepbit.net%3A8332%2FlistenChannel&pool=1 HTTP/1.1
Connection: close
Host: bitproxy.xxx.com
Authorization: Basic xxx
User-Agent: phoenix/v1.2

4) And one more.. not sure why this was necessary, the client didn't say it had seen a new block:

19:14:21.213894
POST / HTTP/1.1
Connection: close
Content-Length: 302
Host: bitproxy.xxx.com
Content-Type: application/json
Authorization: Basic xxx
User-Agent: phoenix/v1.2

{"method": "getwork", "params": [], "id": 1}

5) Ahh now we're getting somewhere....14 seconds later when we have some work done:

19:14:35.187166
POST / HTTP/1.1
Connection: close
Content-Length: 302
Host: bitproxy.xxx.com
Content-Type: application/json
Authorization: Basic xxx
User-Agent: phoenix/v1.2

{"method": "getwork", "params": ["00000001856410222014682e1d4361839ddae0adf1f7415584a4e6d8000006d20000000086ed4af 00f553972b297b1cdbd24d6b99e4720df26ff41229dbd2384c1d0cab44dc480c81b0098fa35cafe bd00000000000000000000000000000000000000000000000000000000000000000000000000000 0000000000000000000"], "id": 1}

At this point, the client disconnects from the proxy and throws the following in the client:

[06/05/2011 19:15:02] Disconnected from server
[06/05/2011 19:15:02] Result: a8b4a195 rejected

Then immediately reconnects to the server:

[06/05/2011 19:15:03] Connected to server

And sends the same message as in 1) above.  I should also note that the apache logs are consistent with the above and I do not see any signs of an error related to these http transactions in the error log.  Hope that helps.
cdhowie (OP)
Full Member
***
Offline Offline

Activity: 182
Merit: 107



View Profile WWW
May 07, 2011, 01:08:36 AM
 #27

In a future version you might want to do some more extensive error handling to let the user know in the admin panel that the "last result" from the pool is that it can't connect because of x or y, and the actual error sent back from the pool was z.
Yes, better validation and logging are on the cards.  I was more concerned with getting the code ready for a proper release than adding features, so this should be coming pretty soon.

I sniffed out the communication going from Phoenix to the proxy only, and this is what it looks like (including timestamps above):
Can you post some more logs, but include the replies from the proxy?  It's hard to diagnose problems when I can only see one half of the conversation.

Authorization: Basic xxx
If I were you I would sanitize these headers too; your username and password are exposed to anyone who understands HTTP basic authentication.

3) Another for long polling?:
Yes, this is a long polling request.

4) And one more.. not sure why this was necessary, the client didn't say it had seen a new block:
It's possible that your client is pre-fetching the next chunk of work so that when it's done with the current chunk it can move on to the next right away.

5) Ahh now we're getting somewhere....14 seconds later when we have some work done:

...

At this point, the client disconnects from the proxy and throws the following in the client:

[06/05/2011 19:15:02] Disconnected from server
[06/05/2011 19:15:02] Result: a8b4a195 rejected
This is where response logs from the proxy would be most helpful, since I can't really tell why it's failing without knowing what the proxy is saying in response.

Tips are always welcome and can be sent to 1CZ8QgBWZSV3nLLqRk2BD3B4qDbpWAEDCZ

Thanks to ye, we have the final piece.

PGP key fingerprint: 2B7A B280 8B12 21CC 260A  DF65 6FCE 505A CF83 38F5

SerajewelKS @ #bitcoin-otc
pwnyboy
Full Member
***
Offline Offline

Activity: 125
Merit: 100


View Profile
May 07, 2011, 02:05:27 AM
 #28

Thanks for the reply, I've sanitized things further in the last post, even though the worker password is of no consequence for me.  Here is the work being sent and the corresponding error:

POST / HTTP/1.1
Connection: close
Content-Length: 302
Host: bitproxy.xxx.com
Content-Type: application/json
Authorization: Basic xxx
User-Agent: phoenix/v1.2

{"method": "getwork", "params": ["0000000129d09b9af4d37ae0641aeaf3618fb62692477035e4f4a17300009697000000004a84ffa 3bb5f69b95dd4656b1267f99f0675fca59a2899b31a07f3eb31992d8e4dc4a7561b0098fa7958ce a500000000000000000000000000000000000000000000000000000000000000000000000000000 0000000000000000000"], "id": 1}

Date: Sat, 07 May 2011 01:59:14 GMT
Server: Apache/2.2.3 (CentOS)
X-Powered-By: PHP/5.1.6
X-Source-Code: https://github.com/cdhowie/Bitcoin-mining-proxy
Set-Cookie: PHPSESSID=6r9lc3ejja26ok9fv5ve84dc44; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Content-Length: 66
Connection: close
Content-Type: application/json-rpc

{"error":"Work not found in proxy database.","result":null,"id":1}
cdhowie (OP)
Full Member
***
Offline Offline

Activity: 182
Merit: 107



View Profile WWW
May 07, 2011, 02:53:36 AM
 #29

Here is the work being sent and the corresponding error:
Hmm.  Can you post the replies to the previous getworks too?  Somehow the work either isn't getting saved in the database correctly, or the worker isn't sending the work back correctly, or something.  I'd have to see the getwork responses and the work submission requests to diagnose this further.

Tips are always welcome and can be sent to 1CZ8QgBWZSV3nLLqRk2BD3B4qDbpWAEDCZ

Thanks to ye, we have the final piece.

PGP key fingerprint: 2B7A B280 8B12 21CC 260A  DF65 6FCE 505A CF83 38F5

SerajewelKS @ #bitcoin-otc
pwnyboy
Full Member
***
Offline Offline

Activity: 125
Merit: 100


View Profile
May 07, 2011, 06:33:15 AM
 #30

Here is a complete exchange including both sides from tcpdump.  The IPs were masked with "xxx" on the first 3 octets as you'll see:


Code:
# tcpdump -n -s 0 -A dst port 80 or src port 80 > /tmp/dump.txt
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes

02:21:27.632988 IP xxx.113.52908 > xxx.170.http: S 3391654312:3391654312(0) win 8192 <mss 1460,nop,wscale 8,nop,nop,sackOK>
E..4..@.~.d.D..qD......P.(........ ..S..............
02:21:27.633083 IP xxx.170.http > xxx.113.52908: S 713576223:713576223(0) ack 3391654313 win 5840 <mss 1460,nop,nop,sackOK,nop,wscale 4>
E..4..@.@...D...D..q.P..*.O..(......0...............
02:21:27.633239 IP xxx.113.52908 > xxx.170.http: . ack 1 win 256
E..(..@.~.d.D..qD......P.(..*.O P....n..
02:21:27.633921 IP xxx.113.52908 > xxx.170.http: P 1:230(229) ack 1 win 256
E..
..@.~.d D..qD......P.(..*.O P....i..POST / HTTP/1.1
Connection: close
Content-Length: 44
Host: bitproxy.xxx.com
Content-Type: application/json
Authorization: Basic xxx
User-Agent: phoenix/v1.2

{"method": "getwork", "params": [], "id": 1}
02:21:27.633942 IP xxx.170.http > xxx.113.52908: . ack 230 win 432
E..(.p@.@..pD...D..q.P..*.O .(..P.......
02:21:28.175445 IP xxx.170.http > xxx.113.52908: P 1:1133(1132) ack 230 win 432
E....q@.@...D...D..q.P..*.O .(..P....u..HTTP/1.1 200 OK
Date: Sat, 07 May 2011 06:21:27 GMT
Server: Apache/2.2.3 (CentOS)
X-Powered-By: PHP/5.1.6
X-Source-Code: https://github.com/cdhowie/Bitcoin-mining-proxy
Set-Cookie: PHPSESSID=ag0fmlipr94a1n4roi99qrs232; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
X-Long-Polling: /index.php?lpurl=http%3A%2F%2Fdeepbit.net%3A8332%2FlistenChannel&pool=1
Content-Length: 596
Connection: close
Content-Type: application/json-rpc

{"error":null,"result":{"midstate":"c409bb59cd614fb25f69b942af4e8f20fb512572dff7bf7e679085671bbd7f03","data":"000000015bb9a0f983558324beead35e719c4e1e4f3e3d0a8f6550bb00003a5e000000000c431765aafaef90465a4ce8ddad3b4e89ca4a618e205acd5a841ea348a09eeb4dc4e4e31b0098fa00000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000080020000","hash1":"00000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000010000","target":"ffffffffffffffffffffffffffffffffffffffffffffffffffffffff00000000"},"id":"json"}
02:21:28.175565 IP xxx.170.http > xxx.113.52908: F 1133:1133(0) ack 230 win 432
E..(.r@.@..nD...D..q.P..*.S..(..P....l..
02:21:28.175875 IP xxx.113.52908 > xxx.170.http: . ack 1134 win 252
E..(..@.~.d.D..qD......P.(..*.S.P.... ..
02:21:28.192774 IP xxx.113.52908 > xxx.170.http: F 230:230(0) ack 1134 win 252
E..(..@.~.d.D..qD......P.(..*.S.P.......
02:21:28.192782 IP xxx.170.http > xxx.113.52908: . ack 231 win 432
E..(.s@.@..mD...D..q.P..*.S..(..P....k..
02:21:28.194594 IP xxx.113.52909 > xxx.170.http: S 2285988338:2285988338(0) win 8192 <mss 1460,nop,wscale 8,nop,nop,sackOK>
E..4..@.~.d.D..qD......P.Ai....... .................
02:21:28.194608 IP xxx.170.http > xxx.113.52909: S 703577298:703577298(0) ack 2285988339 win 5840 <mss 1460,nop,nop,sackOK,nop,wscale 4>
E..4..@.@...D...D..q.P..)....Ai.....%Q..............
02:21:28.194895 IP xxx.113.52909 > xxx.170.http: . ack 1 win 256
E..(..@.~.d.D..qD......P.Ai.)...P...{...
02:21:28.195439 IP xxx.113.52909 > xxx.170.http: P 1:230(229) ack 1 win 256
E..
..@.~.d.D..qD......P.Ai.)...P...v...POST / HTTP/1.1
Connection: close
Content-Length: 44
Host: bitproxy.xxx.com
Content-Type: application/json
Authorization: Basic xxx
User-Agent: phoenix/v1.2

{"method": "getwork", "params": [], "id": 1}
02:21:28.195454 IP xxx.170.http > xxx.113.52909: . ack 230 win 432
E..(..@.@...D...D..q.P..)....Aj.P...z[..
02:21:28.199436 IP xxx.113.52910 > xxx.170.http: S 2903052052:2903052052(0) win 8192 <mss 1460,nop,wscale 8,nop,nop,sackOK>
E..4..@.~.d.D..qD......P.       ........ .9...............
02:21:28.199449 IP xxx.170.http > xxx.113.52910: S 709956609:709956609(0) ack 2903052053 win 5840 <mss 1460,nop,nop,sackOK,nop,wscale 4>
E..4..@.@...D...D..q.P..*Q...   ......................
02:21:28.199742 IP xxx.113.52910 > xxx.170.http: . ack 1 win 256
E..(..@.~.d.D..qD......P.       ..*Q..P...Zu..
02:21:28.200281 IP xxx.113.52910 > xxx.170.http: P 1:203(202) ack 1 win 256
E.....@.~.d.D..qD......P.       ..*Q..P...O...GET /index.php?lpurl=http%3A%2F%2Fdeepbit.net%3A8332%2FlistenChannel&pool=1 HTTP/1.1
Connection: close
Host: bitproxy.xxx.com
Authorization: Basic xxx
User-Agent: phoenix/v1.2


02:21:28.200298 IP xxx.170.http > xxx.113.52910: . ack 203 win 432
E..(..@.@...D...D..q.P..*Q...   ..P...X...
02:21:28.687472 IP xxx.170.http > xxx.113.52909: P 1:1133(1132) ack 230 win 432
E.....@.@..eD...D..q.P..)....Aj.P....u..HTTP/1.1 200 OK
Date: Sat, 07 May 2011 06:21:28 GMT
Server: Apache/2.2.3 (CentOS)
X-Powered-By: PHP/5.1.6
X-Source-Code: https://github.com/cdhowie/Bitcoin-mining-proxy
Set-Cookie: PHPSESSID=opqid2ulnmonksj5qkdo6thuj4; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
X-Long-Polling: /index.php?lpurl=http%3A%2F%2Fdeepbit.net%3A8332%2FlistenChannel&pool=1
Content-Length: 596
Connection: close
Content-Type: application/json-rpc

{"error":null,"result":{"midstate":"5ecbfe50f947ebfbd67ff0c71e54658c17f517d965c763d86ac3868a66a2aae7","data":"000000015bb9a0f983558324beead35e719c4e1e4f3e3d0a8f6550bb00003a5e00000000eee1830529617e61922c5268219db6a18b6f2f8ec6f0b06f5a1d894705f88e2b4dc4e4e31b0098fa00000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000080020000","hash1":"00000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000010000","target":"ffffffffffffffffffffffffffffffffffffffffffffffffffffffff00000000"},"id":"json"}
02:21:28.687592 IP xxx.170.http > xxx.113.52909: F 1133:1133(0) ack 230 win 432
E..(..@.@...D...D..q.P..)..?.Aj.P...u...
02:21:28.687907 IP xxx.113.52909 > xxx.170.http: . ack 1134 win 252
E..(
.@.~.d.D..qD......P.Aj.)..@P...v...
02:21:29.080529 IP xxx.113.52909 > xxx.170.http: F 230:230(0) ack 1134 win 252
E..(
.@.~.d.D..qD......P.Aj.)..@P...v...
02:21:29.080547 IP xxx.170.http > xxx.113.52909: . ack 231 win 432
E..(..@.@...D...D..q.P..)..@.Aj.P...u...
02:21:42.166553 IP xxx.113.52911 > xxx.170.http: S 3058214165:3058214165(0) win 8192 <mss 1460,nop,wscale 8,nop,nop,sackOK>
E..4
.@.~.d8D..qD......P.H........ .................
02:21:42.166588 IP xxx.170.http > xxx.113.52911: S 720814152:720814152(0) ack 3058214166 win 5840 <mss 1460,nop,nop,sackOK,nop,wscale 4>
E..4..@.@...D...D..q.P..*..H.H......................
02:21:42.166882 IP xxx.113.52911 > xxx.170.http: . ack 1 win 256
E..(
.@.~.dCD..qD......P.H..*..IP....G..
02:21:42.167610 IP xxx.113.52911 > xxx.170.http: P 1:230(229) ack 1 win 256
E..

.@.~.c]D..qD......P.H..*..IP... B..POST / HTTP/1.1
Connection: close
Content-Length: 44
Host: bitproxy.xxx.com
Content-Type: application/json
Authorization: Basic xxx
User-Agent: phoenix/v1.2

{"method": "getwork", "params": [], "id": 1}
02:21:42.167631 IP xxx.170.http > xxx.113.52911: . ack 230 win 432
E..(}.@.@.2.D...D..q.P..*..I.H..P.......
02:21:42.666881 IP xxx.170.http > xxx.113.52911: P 1:1133(1132) ack 230 win 432
E...}.@.@.-.D...D..q.P..*..I.H..P....u..HTTP/1.1 200 OK
Date: Sat, 07 May 2011 06:21:42 GMT
Server: Apache/2.2.3 (CentOS)
X-Powered-By: PHP/5.1.6
X-Source-Code: https://github.com/cdhowie/Bitcoin-mining-proxy
Set-Cookie: PHPSESSID=htn9oirmvclsnrcjf9efdic5r4; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
X-Long-Polling: /index.php?lpurl=http%3A%2F%2Fdeepbit.net%3A8332%2FlistenChannel&pool=1
Content-Length: 596
Connection: close
Content-Type: application/json-rpc

{"error":null,"result":{"midstate":"fc9385dbdc6f066c4f06d7b720f0022cf38015b5895eed8f9517d4cc158cf8c6","data":"000000015bb9a0f983558324beead35e719c4e1e4f3e3d0a8f6550bb00003a5e0000000035cfac9a5865f1e5500714aa46e327a3727fd5a481f0b708820f794f6e0dada84dc4e4f11b0098fa00000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000080020000","hash1":"00000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000010000","target":"ffffffffffffffffffffffffffffffffffffffffffffffffffffffff00000000"},"id":"json"}
02:21:42.667032 IP xxx.170.http > xxx.113.52911: F 1133:1133(0) ack 230 win 432
E..(}.@.@.2.D...D..q.P..*....H..P....E..
02:21:42.667198 IP xxx.113.52911 > xxx.170.http: . ack 1134 win 252
E..(
.@.~.d@D..qD......P.H..*...P.......
02:21:43.040604 IP xxx.113.52911 > xxx.170.http: F 230:230(0) ack 1134 win 252
E..(
.@.~.d=D..qD......P.H..*...P.......
02:21:43.040628 IP xxx.170.http > xxx.113.52911: . ack 231 win 432
E..(}.@.@.2.D...D..q.P..*....H..P....D..
02:21:56.115507 IP xxx.113.52912 > xxx.170.http: S 3963094368:3963094368(0) win 8192 <mss 1460,nop,wscale 8,nop,nop,sackOK>
E..4
.@.~.d.D..qD......P.8.`...... .................
02:21:56.115536 IP xxx.170.http > xxx.113.52912: S 743911290:743911290(0) ack 3963094369 win 5840 <mss 1460,nop,nop,sackOK,nop,wscale 4>
E..4..@.@...D...D..q.P..,W/z.8.a....................
02:21:56.115842 IP xxx.113.52912 > xxx.170.http: . ack 1 win 256
E..(
.@.~.d.D..qD......P.8.a,W/{P....y..
02:21:56.118465 IP xxx.113.52912 > xxx.170.http: P 1:230(229) ack 1 win 256
E..

.@.~.c*D..qD......P.8.a,W/{P....t..POST / HTTP/1.1
Connection: close
Content-Length: 44
Host: bitproxy.xxx.com
Content-Type: application/json
Authorization: Basic xxx
User-Agent: phoenix/v1.2

{"method": "getwork", "params": [], "id": 1}
02:21:56.118487 IP xxx.170.http > xxx.113.52912: . ack 230 win 432
E..(.[@.@...D...D..q.P..,W/{.8.FP.......
02:21:56.630388 IP xxx.170.http > xxx.113.52912: P 1:1133(1132) ack 230 win 432
E....\@.@...D...D..q.P..,W/{.8.FP....u..HTTP/1.1 200 OK
Date: Sat, 07 May 2011 06:21:56 GMT
Server: Apache/2.2.3 (CentOS)
X-Powered-By: PHP/5.1.6
X-Source-Code: https://github.com/cdhowie/Bitcoin-mining-proxy
Set-Cookie: PHPSESSID=nvq8v0tcrit13dl2gaf3rp6vb0; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
X-Long-Polling: /index.php?lpurl=http%3A%2F%2Fdeepbit.net%3A8332%2FlistenChannel&pool=1
Content-Length: 596
Connection: close
Content-Type: application/json-rpc

{"error":null,"result":{"midstate":"8905e709a985e89297c0702f3cdff5f2389c5b0d9010e8ded39ac4c898b0464d","data":"000000015bb9a0f983558324beead35e719c4e1e4f3e3d0a8f6550bb00003a5e000000000e824081865a44bfa0d370807db026d218a820bc7571c5fda5bab44f85a85a5b4dc4e4ff1b0098fa00000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000080020000","hash1":"00000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000010000","target":"ffffffffffffffffffffffffffffffffffffffffffffffffffffffff00000000"},"id":"json"}
02:21:56.630500 IP xxx.170.http > xxx.113.52912: F 1133:1133(0) ack 230 win 432
E..(.]@.@...D...D..q.P..,W3..8.FP....w..
02:21:56.630842 IP xxx.113.52912 > xxx.170.http: . ack 1134 win 252
E..(
.@.~.d.D..qD......P.8.F,W3.P....+..
02:21:56.991797 IP xxx.113.52912 > xxx.170.http: F 230:230(0) ack 1134 win 252
E..(
.@.~.d  D..qD......P.8.F,W3.P....*..
02:21:56.991819 IP xxx.170.http > xxx.113.52912: . ack 231 win 432
E..(.^@.@...D...D..q.P..,W3..8.GP....v..
02:22:01.355768 IP xxx.113.52913 > xxx.170.http: S 2483722273:2483722273(0) win 8192 <mss 1460,nop,wscale 8,nop,nop,sackOK>
E..4
.@.~.c.D..qD......P.
.!...... .................
02:22:01.355795 IP xxx.170.http > xxx.113.52913: S 744601149:744601149(0) ack 2483722274 win 5840 <mss 1460,nop,nop,sackOK,nop,wscale 4>
E..4..@.@...D...D..q.P..,a.=.
.".....w..............
02:22:01.355981 IP xxx.113.52913 > xxx.170.http: . ack 1 win 256
E..(
.@.~.c.D..qD......P.
.",a.>P...F...
02:22:01.357701 IP xxx.113.52913 > xxx.170.http: P 1:489(488) ack 1 win 256
E...
.@.~.b.D..qD......P.
.",a.>P.......POST / HTTP/1.1
Connection: close
Content-Length: 302
Host: bitproxy.xxx.com
Content-Type: application/json
Authorization: Basic xxx
User-Agent: phoenix/v1.2

{"method": "getwork", "params": ["000000015bb9a0f983558324beead35e719c4e1e4f3e3d0a8f6550bb00003a5e0000000035cfac9a5865f1e5500714aa46e327a3727fd5a481f0b708820f794f6e0dada84dc4e4f11b0098fafb878b5c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"], "id": 1}
02:22:01.357723 IP xxx.170.http > xxx.113.52913: . ack 489 win 432
E..(f.@.@.I.D...D..q.P..,a.>.
.
P...C...
02:22:01.368776 IP xxx.170.http > xxx.113.52913: P 1:513(512) ack 489 win 432
E..(f.@.@.G.D...D..q.P..,a.>.
.
P....   ..HTTP/1.1 200 OK
Date: Sat, 07 May 2011 06:22:01 GMT
Server: Apache/2.2.3 (CentOS)
X-Powered-By: PHP/5.1.6
X-Source-Code: https://github.com/cdhowie/Bitcoin-mining-proxy
Set-Cookie: PHPSESSID=jjnaeqibh1069oa4e750uov3v1; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Content-Length: 66
Connection: close
Content-Type: application/json-rpc

{"error":"Work not found in proxy database.","result":null,"id":1}
02:22:01.368886 IP xxx.170.http > xxx.113.52913: F 513:513(0) ack 489 win 432
E..(f.@.@.I.D...D..q.P..,a.>.
.
P...A~..
02:22:01.369164 IP xxx.113.52913 > xxx.170.http: . ack 514 win 254
E..(
.@.~.c.D..qD......P.
.
,a.?P...B0..
02:22:01.800364 IP xxx.113.52913 > xxx.170.http: F 489:489(0) ack 514 win 254
E..(
.@.~.c.D..qD......P.
.
,a.?P...B/..
02:22:01.800388 IP xxx.170.http > xxx.113.52913: . ack 490 win 432
E..(f.@.@.I.D...D..q.P..,a.?.
..P...A}..
02:22:02.236887 IP xxx.113.52914 > xxx.170.http: S 3434189684:3434189684(0) win 8192 <mss 1460,nop,wscale 8,nop,nop,sackOK>
E..4
.@.~.c.D..qD......P...t...... .................
02:22:02.236914 IP xxx.170.http > xxx.113.52914: S 742812174:742812174(0) ack 3434189685 win 5840 <mss 1460,nop,nop,sackOK,nop,wscale 4>
E..4..@.@...D...D..q.P..,Fj....u....................
02:22:02.237217 IP xxx.113.52914 > xxx.170.http: . ack 1 win 256
E..(
.@.~.c.D..qD......P...u,Fj.P...^f..
02:22:02.237772 IP xxx.113.52914 > xxx.170.http: P 1:230(229) ack 1 win 256
E..

.@.~.b.D..qD......P...u,Fj.P...Ya..POST / HTTP/1.1
Connection: close
Content-Length: 44
Host: bitproxy.xxx.com
Content-Type: application/json
Authorization: Basic xxx
User-Agent: phoenix/v1.2

{"method": "getwork", "params": [], "id": 1}
02:22:02.237787 IP xxx.170.http > xxx.113.52914: . ack 230 win 432
E..(..@.@...D...D..q.P..,Fj....ZP...\...
02:22:02.726166 IP xxx.170.http > xxx.113.52914: P 1:1133(1132) ack 230 win 432
E.....@.@..^D...D..q.P..,Fj....ZP....u..HTTP/1.1 200 OK
Date: Sat, 07 May 2011 06:22:02 GMT
Server: Apache/2.2.3 (CentOS)
X-Powered-By: PHP/5.1.6
X-Source-Code: https://github.com/cdhowie/Bitcoin-mining-proxy
Set-Cookie: PHPSESSID=0ecg4k48echds2qcnhfs1tr8q3; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
X-Long-Polling: /index.php?lpurl=http%3A%2F%2Fdeepbit.net%3A8332%2FlistenChannel&pool=1
Content-Length: 596
Connection: close
Content-Type: application/json-rpc

{"error":null,"result":{"midstate":"8a305c3e93669380e4075f4dcd8785990b60953362b1bf9b2e825aa5b287571f","data":"000000015bb9a0f983558324beead35e719c4e1e4f3e3d0a8f6550bb00003a5e00000000787bdec7bc46a3ebeca98e8d7f74ced0eb66583fb1ded4b164d0bc18b502f9164dc4e5051b0098fa00000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000080020000","hash1":"00000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000010000","target":"ffffffffffffffffffffffffffffffffffffffffffffffffffffffff00000000"},"id":"json"}
02:22:02.726319 IP xxx.170.http > xxx.113.52914: F 1133:1133(0) ack 230 win 432
E..(..@.@...D...D..q.P..,Fn{...ZP...Xd..
02:22:02.726488 IP xxx.113.52914 > xxx.170.http: . ack 1134 win 252
E..(..@.~.c.D..qD......P...Z,Fn|P...Y...
02:22:03.114950 IP xxx.113.52910 > xxx.170.http: F 203:203(0) ack 1 win 256
E..(..@.~.c.D..qD......P.       ..*Q..P...Y...
02:22:03.115170 IP xxx.113.52914 > xxx.170.http: F 230:230(0) ack 1134 win 252
E..(..@.~.c.D..qD......P...Z,Fn|P...Y...
02:22:03.115182 IP xxx.170.http > xxx.113.52914: . ack 231 win 432
E..(..@.@...D...D..q.P..,Fn|...[P...Xc..
02:22:03.154389 IP xxx.170.http > xxx.113.52910: . ack 204 win 432
E..(..@.@...D...D..q.P..*Q...   ..P...X...
cdhowie (OP)
Full Member
***
Offline Offline

Activity: 182
Merit: 107



View Profile WWW
May 07, 2011, 05:44:41 PM
Last edit: May 07, 2011, 05:56:29 PM by cdhowie
 #31

Here is a complete exchange including both sides from tcpdump.  The IPs were masked with "xxx" on the first 3 octets as you'll see:
Perfect, that's exactly the data I needed.

The error you are getting back from the work submission should indeed not be happening; the submitted work does match one of the getwork requests.  Can you execute this query against your database and see if it gets any results?  If it doesn't, can you verify that your work_data table has any records in it at all?

Code:
SELECT * FROM `work_data` WHERE `data` = '000000015bb9a0f983558324beead35e719c4e1e4f3e3d0a8f6550bb00003a5e0000000035cfac9a5865f1e5500714aa46e327a3727fd5a481f0b708820f794f6e0dada84dc4e4f11b0098fa';

Edit: I just checked the code and if the INSERT into the work_data table fails, it will do so silently, still returning the work to the client.  I need to patch this, since the client shouldn't be given work that can't be registered, or the proxy won't know which pool to route it too (I think this is the problem you are seeing).  We still need to figure out why the INSERT is failing though.

Edit 2: I think I found the problem with work submissions.  Please update to the latest code from Git.

Tips are always welcome and can be sent to 1CZ8QgBWZSV3nLLqRk2BD3B4qDbpWAEDCZ

Thanks to ye, we have the final piece.

PGP key fingerprint: 2B7A B280 8B12 21CC 260A  DF65 6FCE 505A CF83 38F5

SerajewelKS @ #bitcoin-otc
pwnyboy
Full Member
***
Offline Offline

Activity: 125
Merit: 100


View Profile
May 07, 2011, 11:44:26 PM
 #32

My work_data table had 192 entries.  I cloned the tree again and replaced the contents of htdocs, copying over the same config file, and the error is still the same on the client side.  Let me know if there is anything else I can do to help troubleshoot.
cdhowie (OP)
Full Member
***
Offline Offline

Activity: 182
Merit: 107



View Profile WWW
May 07, 2011, 11:47:56 PM
 #33

My work_data table had 192 entries.  I cloned the tree again and replaced the contents of htdocs, copying over the same config file, and the error is still the same on the client side.  Let me know if there is anything else I can do to help troubleshoot.
Hmm.  Can you run the query I gave and see what it returns?  Also, you shouldn't need to clone anything again -- just git pull from inside the git root.

Tips are always welcome and can be sent to 1CZ8QgBWZSV3nLLqRk2BD3B4qDbpWAEDCZ

Thanks to ye, we have the final piece.

PGP key fingerprint: 2B7A B280 8B12 21CC 260A  DF65 6FCE 505A CF83 38F5

SerajewelKS @ #bitcoin-otc
pwnyboy
Full Member
***
Offline Offline

Activity: 125
Merit: 100


View Profile
May 08, 2011, 12:21:12 AM
 #34

Yes, it's in there.

mysql> SELECT * FROM `work_data` WHERE `data` = '000000015bb9a0f983558324beead35e719c4e1e4f3e3d0a8f6550bb00003a5e0000000035cfac9 a5865f1e5500714aa46e327a3727fd5a481f0b708820f794f6e0dada84dc4e4f11b0098fa';
+-----------+---------+----------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------+
| worker_id | pool_id | data                                                                                                                                                     | time_requested      |
+-----------+---------+----------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------+
|         1 |       1 | 000000015bb9a0f983558324beead35e719c4e1e4f3e3d0a8f6550bb00003a5e0000000035cfac9 a5865f1e5500714aa46e327a3727fd5a481f0b708820f794f6e0dada84dc4e4f11b0098fa | 2011-05-07 06:21:42 |
+-----------+---------+----------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------+
1 row in set (0.00 sec)

mysql>
cdhowie (OP)
Full Member
***
Offline Offline

Activity: 182
Merit: 107



View Profile WWW
May 08, 2011, 04:25:54 AM
 #35

Yes, it's in there.
Hmm, weird.  Can you put the contents of this script in a PHP file alongside index.php (in other words, directly in the web root) and paste me its output?  Of course, sanitize the username and password if they get displayed.

Code:
<?php

require_once(dirname(__FILE__) . '/common.inc.php');

header('Content-Type: text/plain');

$pdo db_connect();

$q $pdo->prepare('
    SELECT
        p.id AS pool_id,
        wp.pool_username AS username,
        wp.pool_password AS password,
        p.url AS url

    FROM
        work_data d,
        worker_pool wp,
        pool p

    WHERE d.data = :data
      AND d.worker_id = :worker_id

      AND d.pool_id = p.id

      AND wp.worker_id = :worker_id
      AND wp.pool_id = p.id
'
);

if (
$q === FALSE) {
    echo 
"Unable to prepare statement: ";
    
var_export($pdo->errorInfo());
    exit;
}

$result $q->execute(array(
    
':worker_id'    => 1,
    
':data'         => '000000015bb9a0f983558324beead35e719c4e1e4f3e3d0a8f6550bb00003a5e0000000035cfac9a5865f1e5500714aa46e327a3727fd5a481f0b708820f794f6e0dada84dc4e4f11b0098fa'));

if (!
$result) {
    echo 
"Unable to execute statement: ";
    
var_export($q->errorInfo());
    exit;
}

$row $q->fetch();
$q->closeCursor();

if (
$row === FALSE) {
    echo 
"No rows found.";
    exit;
}

echo 
"Row found: ";
var_export($row);

?>

Tips are always welcome and can be sent to 1CZ8QgBWZSV3nLLqRk2BD3B4qDbpWAEDCZ

Thanks to ye, we have the final piece.

PGP key fingerprint: 2B7A B280 8B12 21CC 260A  DF65 6FCE 505A CF83 38F5

SerajewelKS @ #bitcoin-otc
pwnyboy
Full Member
***
Offline Offline

Activity: 125
Merit: 100


View Profile
May 08, 2011, 07:10:59 AM
 #36

That script returns "No rows found."  Preemptively I'm going to send you the contents of tables "worker", "worker_pool" and "pool" with passwords removed, since it looks like that's the information you're looking for with the aforementioned php script:

mysql> select * from worker;
+----+-------+-----------+
| id | name  | password  |
+----+-------+-----------+
|  1 | w0113 | xxxxx |
+----+-------+-----------+
1 row in set (0.00 sec)

mysql> select * from worker_pool
    -> ;
+---------+-----------+------------------------+---------------+----------+---------+
| pool_id | worker_id | pool_username          | pool_password | priority | enabled |
+---------+-----------+------------------------+---------------+----------+---------+
|       1 |         1 | xxxxxxxxx@xxxxx.com_10 | xxxxxxxxxxx     |        1 |       1 |
+---------+-----------+------------------------+---------------+----------+---------+
1 row in set (0.00 sec)

mysql> select * from pool;
+----+---------+-------------------------+---------+
| id | name    | url                     | enabled |
+----+---------+-------------------------+---------+
|  1 | deepbit | http://deepbit.net:8332 |       1 |
+----+---------+-------------------------+---------+
1 row in set (0.00 sec)

Based on my lay knowledge of php, I can't imagine why it doesn't return anything from the script you sent.  Is it possible that my installation (default php 5.1 from CentOS 5.x with php-* installed, mysql-* installed, and the add-in json libraries) is different, misconfigured, or missing a dependency?  For reference, it already works fine with other popular MySQL/PHP off the shelf applications.

Also sent you 5 BTC to the address in your signature for all the work you're putting in; this is in addition to my previous commitment to send you 10 when it appears that this works and is viable.  Thanks again for your help.
pwnyboy
Full Member
***
Offline Offline

Activity: 125
Merit: 100


View Profile
May 08, 2011, 07:20:13 AM
 #37

One more that I meant to send:

mysql> select * from work_data where data = '000000015bb9a0f983558324beead35e719c4e1e4f3e3d0a8f6550bb00003a5e0000000035cfac9 a5865f1e5500714aa46e327a3727fd5a481f0b708820f794f6e0dada84dc4e4f11b0098fa';
+-----------+---------+----------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------+
| worker_id | pool_id | data                                                                                                                                                     | time_requested      |
+-----------+---------+----------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------+
|         1 |       1 | 000000015bb9a0f983558324beead35e719c4e1e4f3e3d0a8f6550bb00003a5e0000000035cfac9 a5865f1e5500714aa46e327a3727fd5a481f0b708820f794f6e0dada84dc4e4f11b0098fa | 2011-05-07 06:21:42 |
+-----------+---------+----------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------+
1 row in set (0.00 sec)

mysql>
cdhowie (OP)
Full Member
***
Offline Offline

Activity: 182
Merit: 107



View Profile WWW
May 08, 2011, 01:50:32 PM
 #38

That script returns "No rows found."

....

Based on my lay knowledge of php, I can't imagine why it doesn't return anything from the script you sent.
#$%&.  Me either... though I do have a few ideas...

Is it possible that my installation (default php 5.1 from CentOS 5.x with php-* installed, mysql-* installed, and the add-in json libraries) is different, misconfigured, or missing a dependency?  For reference, it already works fine with other popular MySQL/PHP off the shelf applications.
It should work fine.  I'm on PHP 5.3.3, but all my code should be compatible with most PHP5 versions (and probably some PHP4 versions too).

To further diagnose this, can you try this script now?

Code:
<?php

require_once(dirname(__FILE__) . '/common.inc.php');

header('Content-Type: text/plain');

$pdo db_connect();

function 
try_query($sql$args) {
    global 
$pdo;

    
$q $pdo->prepare($sql);

    if (
$q === FALSE) {
        return 
"Could not prepare statement (" var_export($pdo->errorInfo(), true) . ")";
    }

    
$result $q->execute($args);

    if (!
$result) {
        return 
"Could not execute statement (" var_export($q->errorInfo(), true) . ")";
    }

    
$row $q->fetch();

    if (
$row === FALSE) {
        return 
"No rows found";
    }

    
$q->closeCursor();

    return 
"Success (" var_export($rowtrue) . ")";
}

$queries = array(
    array(
'name' => 'original',
          
'args' => array(':worker_id'    => 1,
                          
':data'         => '000000015bb9a0f983558324beead35e719c4e1e4f3e3d0a8f6550bb00003a5e0000000035cfac9a5865f1e5500714aa46e327a3727fd5a481f0b708820f794f6e0dada84dc4e4f11b0098fa'),
          
'query' => '
                SELECT
                    p.id AS pool_id,
                    wp.pool_username AS username,
                    wp.pool_password AS password,
                    p.url AS url

                FROM
                    work_data d,
                    worker_pool wp,
                    pool p

                WHERE d.data = :data
                  AND d.worker_id = :worker_id

                  AND d.pool_id = p.id

                  AND wp.worker_id = :worker_id
                  AND wp.pool_id = p.id
          '
),
    array(
'name' => 'hardcoded',
          
'args' => array(),
          
'query' => "
                SELECT
                    p.id AS pool_id,
                    wp.pool_username AS username,
                    wp.pool_password AS password,
                    p.url AS url

                FROM
                    work_data d,
                    worker_pool wp,
                    pool p

                WHERE d.data = '000000015bb9a0f983558324beead35e719c4e1e4f3e3d0a8f6550bb00003a5e0000000035cfac9a5865f1e5500714aa46e327a3727fd5a481f0b708820f794f6e0dada84dc4e4f11b0098fa'
                  AND d.worker_id = 1

                  AND d.pool_id = p.id

                  AND wp.worker_id = 1
                  AND wp.pool_id = p.id
          "
),
    array(
'name' => 'nodup',
          
'args' => array(':worker_id'     => 1,
                          
':worker_id_two' => 1,
                          
':data'          => '000000015bb9a0f983558324beead35e719c4e1e4f3e3d0a8f6550bb00003a5e0000000035cfac9a5865f1e5500714aa46e327a3727fd5a481f0b708820f794f6e0dada84dc4e4f11b0098fa'),
          
'query' => '
                SELECT
                    p.id AS pool_id,
                    wp.pool_username AS username,
                    wp.pool_password AS password,
                    p.url AS url

                FROM
                    work_data d,
                    worker_pool wp,
                    pool p

                WHERE d.data = :data
                  AND d.worker_id = :worker_id

                  AND d.pool_id = p.id

                  AND wp.worker_id = :worker_id_two
                  AND wp.pool_id = p.id
          '
),
    array(
'name' => 'no underscore',
          
'args' => array(':workerid'    => 1,
                          
':data'         => '000000015bb9a0f983558324beead35e719c4e1e4f3e3d0a8f6550bb00003a5e0000000035cfac9a5865f1e5500714aa46e327a3727fd5a481f0b708820f794f6e0dada84dc4e4f11b0098fa'),
          
'query' => '
                SELECT
                    p.id AS pool_id,
                    wp.pool_username AS username,
                    wp.pool_password AS password,
                    p.url AS url

                FROM
                    work_data d,
                    worker_pool wp,
                    pool p

                WHERE d.data = :data
                  AND d.worker_id = :workerid

                  AND d.pool_id = p.id

                  AND wp.worker_id = :workerid
                  AND wp.pool_id = p.id
          '
)
);

foreach (
$queries as $query) {
    echo 
$query['name'];
    echo 
': ';
    echo 
try_query($query['query'], $query['args']);
    echo 
"\n";
}

?>

Also sent you 5 BTC to the address in your signature for all the work you're putting in; this is in addition to my previous commitment to send you 10 when it appears that this works and is viable.  Thanks again for your help.
Cool, thanks!  Hopefully we can get this working soon.  Obscure bugs are annoying.  Sad

Tips are always welcome and can be sent to 1CZ8QgBWZSV3nLLqRk2BD3B4qDbpWAEDCZ

Thanks to ye, we have the final piece.

PGP key fingerprint: 2B7A B280 8B12 21CC 260A  DF65 6FCE 505A CF83 38F5

SerajewelKS @ #bitcoin-otc
Cdecker
Hero Member
*****
Offline Offline

Activity: 489
Merit: 504



View Profile WWW
May 08, 2011, 05:18:39 PM
 #39

I love this one. It make switching really painless, especially after todays outage of slush's pool this proved a timesaver. What I noticed however that the failing pool will still be asked for work, and only he doesn't return any, the next one will be asked. Are there plans for exponential backoff in order to avoid the extra request and the extra idle time? Just a mechanism to automatically blacklist a pool should it fail, and increase the blacklist time on each subsequent failure would be cool.
The problem today is that slush sometimes gives me work, but does not accept the result (timeout/502 errors/...).

Also I get a lot of these:
Quote
192.168.3.5 - pilum [08/May/2011:19:21:43 +0200] "POST /index.php?lpurl=http%3A%2F%2Fdeepbit.net%3A8332%2FlistenChannel&pool=2 HTTP/1.1" 200 1181 "-" "Java/1.6.0_22"
192.168.3.5 - pilum [08/May/2011:19:21:45 +0200] "POST /index.php?lpurl=http%3A%2F%2Fdeepbit.net%3A8332%2FlistenChannel&pool=2 HTTP/1.1" 200 1181 "-" "Java/1.6.0_22"
192.168.3.5 - pilum [08/May/2011:19:21:47 +0200] "POST /index.php?lpurl=http%3A%2F%2Fdeepbit.net%3A8332%2FlistenChannel&pool=2 HTTP/1.1" 200 1181 "-" "Java/1.6.0_22"
192.168.3.5 - pilum [08/May/2011:19:21:49 +0200] "POST /index.php?lpurl=http%3A%2F%2Fdeepbit.net%3A8332%2FlistenChannel&pool=2 HTTP/1.1" 200 1181 "-" "Java/1.6.0_22"
192.168.3.5 - pilum [08/May/2011:19:21:49 +0200] "POST /index.php?lpurl=http%3A%2F%2Fdeepbit.net%3A8332%2FlistenChannel&pool=2 HTTP/1.1" 200 1181 "-" "Java/1.6.0_22"
Which makes me think that the diablo miner does not really take advantage of the long polling feature, and I start feeling bad for bombing pools with all those long poll requests. Any ideas?

Want to see what developers are chatting about? http://bitcoinstats.com/irc/bitcoin-dev/logs/
Bitcoin-OTC Rating
pwnyboy
Full Member
***
Offline Offline

Activity: 125
Merit: 100


View Profile
May 08, 2011, 07:17:20 PM
 #40


To further diagnose this, can you try this script now?

This is the result, sanitized to remove portions of my email/password at deepbit:

original: No rows found
hardcoded: Success (array (
  'pool_id' => '1',
  0 => '1',
  'username' => 'xxx@xxx.com_10',
  1 => 'xxx@xxx.com_10',
  'password' => 'xxx',
  2 => 'xxx',
  'url' => 'http://deepbit.net:8332',
  3 => 'http://deepbit.net:8332',
))
nodup: Success (array (
  'pool_id' => '1',
  0 => '1',
  'username' => 'xxx@xxx.com_10',
  1 => 'xxx@xxx.com_10',
  'password' => 'xxx',
  2 => 'xxx',
  'url' => 'http://deepbit.net:8332',
  3 => 'http://deepbit.net:8332',
))
no underscore: No rows found
Pages: « 1 [2] 3 4 5 6 7 8 9 10 11 12 13 14 15 16 »  All
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!