forknote / forknote-pool

Mining pool for Bytecoin/Forknote based coins such as Bytecoin and Dashcoin.
https://github.com/forknote/forknote-pool
GNU General Public License v2.0
122 stars 185 forks source link

Website not response (API) #40

Open ridd84 opened 6 years ago

ridd84 commented 6 years ago

Hi, I have a pool and each (5 or 10 days) I have problems with website, for example:

1) When I enter in website, I see (loading circle), but nothings happens, I don't see data. If I check miner, Mining works fine without errors... 2) I try to check from browser (F12), I see some api errors (not response). 3) To solve, I enter in pool server (ssh) and kill node and start again (then website works weel again) 4) from admin area I see latest (coin daemon/wallet) errors

{"code":"EMFILE","errno":"EMFILE","syscall":"connect"}

5) I check other files, in (chartsDataCollector_crash.log) I see:

TypeError: Cannot read property 'minersHashrate' of undefined
    at /pool/lib/charts.js:167:22
    at ClientRequest.<anonymous> (/pool/lib/apiInterfaces.js:39:9)
    at ClientRequest.emit (events.js:95:17)
    at Socket.socketOnEnd [as onend] (http.js:1631:9)
    at Socket.g (events.js:180:16)
    at Socket.emit (events.js:117:20)
    at _stream_readable.js:944:16
    at process._tickCallback (node.js:458:13)

Any idea or things to do to check what it happens when I have this error? many API requests?

Thanks in advance

UPDATE 01/20/2018 It seams that there is a problem with (open files 1024) https://stackoverflow.com/questions/34588/how-do-i-change-the-number-of-open-files-limit-in-linux

I can check when it happens with (ulimit -a)

I just edited (/etc/sysctl.conf) and (/etc/security/limits.conf)

In a few days I will know if it is that and I will give the answer

ridd84 commented 6 years ago

I see other cryptonote pools with same problem, API not response (randomly).

Someone knows what can I do to try to solve??

Thanks

cycleworm commented 6 years ago

how do you start the pool server? how does your "config.json" for the pool look like?

have you enabled the poolServer? grafik

have you installed redis-server for storing all the stats? grafik

have you enabled the API and defined the right port? grafik

the API port also has to be defined in the "config.js" file of the website. grafik

ridd84 commented 6 years ago

Hi, thanks for your answer, and of course, pool works 100% since August.

I doed this change last day (https://github.com/forknote/forknote-pool/commit/f1d68831676d9acb930d7241b5ed430e6a02520a) and from those moment API doesn't had more problems

image

I wait few days more and tell you something, thanks!

cycleworm commented 6 years ago

nice. i am new to the pool stuff. i am working on a pool setup for about two weeks now. with every day it gets better. are you willing to answer a few questions? can i reach you somewhere on IRC or something like that?

ridd84 commented 6 years ago

hi @cycleworm , if you want we can start by email (pool [at] pool . cat)

msilvoli commented 6 years ago

Hi @gcasas84 and @cycleworm ! I don't know if you can give some "light".....

I'm facing a crazy problem with the API loading eternally (loading circle as you described) and not showing the statistics from Monero running on openSUSE 42.3, apache 2.4, npm 2.15.1, node 0.10.48

Daemon is synchronized and started as: ./monerod --config-file /etc/monerod.conf --p2p-bind-ip 172.x.x.x --rpc-bind-ip 172.x.x.x --zmq-rpc-bind-ip 172.x.x.x --confirm-external-bind

Wallet-rpc started as : ./monero-wallet-rpc --daemon-host 172.x.x.x --daemon-port 18081 --rpc-bind-ip 172.x.x.x --rpc-bind-port 38082 --wallet-file mywallet --confirm-external-bind but the wallet is stuck on "Starting wallet rpc server...". I synchronized wallet before with wallet-cli and this is still happening. Using --log-level 4 I can see the blocks and the balance in wallet....

Node started normally, showing connection ports, api port 8117, and no errors. My node config "api": { "enabled": true, "hashrateWindow": 600, "updateInterval": 10, "port": 8117, "blocks": 30, "payments": 30, "password": "Mypassword" }, "daemon": { "host": "172.x.x.x", "port": 18081 }, "wallet": { "host": "172.x.x.x", "port": 38082 },

Redis running normally in other application I have....

My API config var api = "http://172.x.x.x:8117"; var poolHost = "172.x.x.x";

No firewall active, and the inspect console on google chrome is showing "Failed to load 172.x.x.x/stats resource: net::ERR_CONNECTION_TIMED_OUT

If someone can help, I really appreciate. I saw this is a recurring problem in other forks and I checked everything here in the issues before open the ticket. A few users in forks like zone117x solved the problem but they didn't informe here on github how they solved it :- (

Thank you screenshot from 2017-11-24 22-59-05 screenshot from 2017-11-24 23-00-00 screenshot from 2017-11-24 22-59-37

ridd84 commented 6 years ago

hi @msilvoli , I see that you use 2 diferent IP and don't know why...

192.168.0.50 = web server? 172.27.9.5 = daemon + wallet + pool ?

Normally I use:

daemon = 127.0.0.1 wallet = 127.0.0.1 api = http://publicip:8117

you have access to both of them from your computer? also you can get response with ((ping)), and make telnet to port (8117)?? check it and tell me please...

msilvoli commented 6 years ago

Hi @gcasas84, Thank you for your prompt response. Let me update your questions.

The Daemon + API + pool are running on 172.27.9.5 (this is my internal network and interfaces with NO firewall) and all of these are not available for public access. Can you check if I started them correctly in my previous post ? I decide to use 172.27.9.5 instead of 127.0.0.1.

My apache server is running in a different IP under the same subnet of the above (172.27.9.x)

The range of addresses 192.168.x.x you see in my browser screenshots are from my Wi-Fi ISP router, they are my "side" of private IPs (and general home internet connection which I'm using now) and the other "side" is my public IP.

So to access the pool API as you can see, I enter 192.168.0.50:8080 in a web browser and I hit my main firewalled server (with two interfaces, one in 172.x.x.x and other on 192.x.x.x). So the main server redirects to my APACHE.

I can ping 192.168.0.50 from any computer in the same subnet, OK for telnet locally (172.27.9.5) on port 8117.

Using NMAP from 192.168.x.x subnet nmap -p 8080 192.168.0.50 Starting Nmap 6.47 ( http://nmap.org ) at 2017-11-25 10:48 MST Nmap scan report for myserver.myrouter (192.168.0.50) Host is up (0.0020s latency). PORT STATE SERVICE 8080/tcp open http-proxy MAC Address: C0:2A:FF:1B:02:B2 (Unknown)

Using NPING nping --tcp -p 8080 192.168.0.50

Starting Nping 0.6.47 ( http://nmap.org/nping ) at 2017-11-25 10:55 MST SENT (0.0588s) TCP 192.168.0.15:20454 > 192.168.0.50:8080 S ttl=64 id=57300 iplen=40 seq=973765907 win=1480 RCVD (0.2172s) TCP 192.168.0.50:8080 > 192.168.0.15:20454 SA ttl=63 id=0 iplen=44 seq=3808413083 win=29200 <mss 1460> SENT (1.0592s) TCP 192.168.0.15:20454 > 192.168.0.50:8080 S ttl=64 id=57300 iplen=40 seq=973765907 win=1480 RCVD (1.2171s) TCP 192.168.0.50:8080 > 192.168.0.15:20454 SA ttl=63 id=0 iplen=44 seq=3824047766 win=29200 <mss 1460> SENT (2.0611s) TCP 192.168.0.15:20454 > 192.168.0.50:8080 S ttl=64 id=57300 iplen=40 seq=973765907 win=1480 RCVD (2.2173s) TCP 192.168.0.50:8080 > 192.168.0.15:20454 SA ttl=63 id=0 iplen=44 seq=3839698524 win=29200 <mss 1460> SENT (3.0623s) TCP 192.168.0.15:20454 > 192.168.0.50:8080 S ttl=64 id=57300 iplen=40 seq=973765907 win=1480 RCVD (3.2171s) TCP 192.168.0.50:8080 > 192.168.0.15:20454 SA ttl=63 id=0 iplen=44 seq=3855368582 win=29200 <mss 1460> SENT (4.0642s) TCP 192.168.0.15:20454 > 192.168.0.50:8080 S ttl=64 id=57300 iplen=40 seq=973765907 win=1480 RCVD (4.2171s) TCP 192.168.0.50:8080 > 192.168.0.15:20454 SA ttl=63 id=0 iplen=44 seq=3870997104 win=29200 <mss 1460>

Max rtt: 158.251ms | Min rtt: 152.799ms | Avg rtt: 155.882ms Raw packets sent: 5 (200B) | Rcvd: 5 (230B) | Lost: 0 (0.00%) Nping done: 1 IP address pinged in 4.25 seconds

Thank you again !

ridd84 commented 6 years ago

Hi @msilvoli , I think that you have problems with some NAT rule, port 8080 is only web port, you need to map API port 8117 from outbound network, please, use API with

var api = "http://192.168.0.50:8117";

and make NAT from 8117 to ip: 172.27.9.5

msilvoli commented 6 years ago

Hi @gcasas84 ,

I try something like this before (I repeated some steps) and I did what you ask me to do so let's go to the results:

When I did what you ask --> setting the config to var api = "http://192.168.0.50:8117"; I got Invalid API call in the cases below: 1 - Setting my firewall to get all requests from 192.168.0.x:8117 and send to 172.27.9.5:8117 2 - Setting my firewall to get all requests from 192.168.0.x:8080 and sent to 172.27.9.5:80

and got infinite loading web page in the case below 1 - Setting my firewall to get all requests from 192.168.0.x:8117 and send to 172.27.9.5:80

When the website config file is set to var api = "http://172.27.9.5:8117"; I got Invalid API call in the case below: 1 - Setting my firewall to get all requests from 192.168.0.x:anyport and sent to 172.27.9.5:8117

When the website config file is set to var api = "http://172.27.9.5:8117"; I got infinite loading web page in the case below 1 - Setting my firewall to get all requests from 192.168.0.x:anyport and send to 172.27.9.5:80

Update: from a windows machine (windows server 2012) running on same subnet (172.27.9.x) I have the same problem with the infinite loading...and in this case there's no firewall acting because it's a direct connection.

Thank you !

ridd84 commented 6 years ago

Ok, we need to solve first in same subnet, please print result of listening ports here

netstat -ntlp | grep LISTEN

msilvoli commented 6 years ago

Hi @gcasas84, Sorry for late response.... For some reason I cannot explain, the API started working on same subnet (172.27.9.5) and I didn't change anything. Another thing happening is that I dont' add the port (8117) on the browser address, I use only http://172.27.9.5 but I think it's the apache host config.

screenshot from 2017-11-26 14-28-21 screenshot from 2017-11-26 14-49-31

The result for your LISTEN question (I removed non essential lines)

tcp 0 0 0.0.0.0:80 0.0.0.0: LISTEN 4504/httpd-prefork
tcp 0 0 0.0.0.0:5555 0.0.0.0:
LISTEN 7625/node
tcp 0 0 0.0.0.0:8117 0.0.0.0: LISTEN 7728/node
tcp 0 0 0.0.0.0:1111 0.0.0.0:
LISTEN 7625/node
tcp 0 0 172.27.9.5:18080 0.0.0.0: LISTEN 5864/monerod
tcp 0 0 0.0.0.0:7777 0.0.0.0:
LISTEN 7625/node
tcp 0 0 172.27.9.5:18081 0.0.0.0: LISTEN 5864/monerod
tcp 0 0 172.27.9.5:38082 0.0.0.0:
LISTEN 5922/monero-wallet-rpc tcp 0 0 172.27.9.5:18082 0.0.0.0: LISTEN 5864/monerod
tcp 0 0 0.0.0.0:3333 0.0.0.0:
LISTEN 7625/node

Ports: 1111, 3333, 5555, 7777 -->> mining ports 80 --> http apache 8117 --> API 18080 --> P2P 18081 --> Daemon 18082 --> This is one of my doubts ZMQ... 38082 --> Wallet RPC

Well it's working but I have other errors in Admin Page. Wallet last status = FAIL (in monitoring) Registered address is null (should be 1 I believe) and NaN and Lucky as well screenshot from 2017-11-26 14-46-26 screenshot from 2017-11-26 14-46-05

Thank you again !

ridd84 commented 6 years ago

Ok, we need to check wallet first, try with

./monero-wallet-rpc --daemon-host 127.0.0.1 --daemon-port 18081 --rpc-bind-ip 127.0.0.1 --wallet-rpc-bind-port 38082 --wallet-file mywallet --confirm-external-bind

msilvoli commented 6 years ago

Hi @gcasas84, Sorry for the late response but I'm outside my home these days as soon as I return home I will test this configuration. But let me ask you a question: do you want me to start all of this as Localhost (127.0.0.1) or using my ip config 172.27.9.5?

ridd84 commented 6 years ago

Hi @msilvoli , start with 127.0.0.1 and check if wallet works, use this please

./monero-wallet-rpc --daemon-host 127.0.0.1 --daemon-port 18081 --rpc-bind-ip 127.0.0.1 --wallet-rpc-bind-port 38082 --wallet-file mywallet --confirm-external-bind

vitorgamer58 commented 6 years ago

i have the same problem website not works it worked perfectly, but I left it a few days off and then it no longer works.

I used the address: niobiopool.ddns.net when I type http://niobiopool.ddns.net:8117/ I get an "Invalid API call"

the daemon is 100% synchronized with the network, the wallet is also working.

screenshot_94

screenshot

vitorgamer58 commented 6 years ago

screenshot_95 screenshot_96

msilvoli commented 6 years ago

Hi @gcasas84, Sorry for late reply....I followed your suggestion (as localhost) but I have the same result (check the screenshots). I re-check firewall to avoid any mistake, changed the config.json to the correct IP 127.0.0.1 for daemon and wallet, restarted the HTTP server, (API still running on 172.27.x.x to get your screenshot because the server doesn't have GUI interface) but using telnet I have connection to API as localhost. The daemon is up-to-date, the wallet-rpc was initialized as it follows (with a correction at your line parameter --wallet-rpc-bind-ip that doesn't exists) and everything seems to be ok. Mining at fixed difficult 25000 I'm browsing another solutions but until now, nothing is working. screenshot from 2017-12-07 16-21-38 screenshot from 2017-12-07 16-27-14 screenshot from 2017-12-07 16-07-13 screenshot from 2017-12-07 21-17-52

msilvoli commented 6 years ago

@Vitorgamer58 It seems your var api is wrong in config file. It should be http://niobiopool.ddns.net Try this and let me know. Cheers.

msilvoli commented 6 years ago

@gcasas84 @cycleworm

The result for RPC method trigged by the webpage "monitoring" in Admin area and parsed by /API/api.js using the methods specified in config.json (getblockcount for the daemon and getbalance for the wallet) is similar to the command line code below isn't it?

curl -X POST http://127.0.0.1:38082/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"getbalance"}' -H 'Content-Type: application/json'

So in this case the result should be my-wallet-amount and not the unauthorized access Maybe my problem is something with the wallet, but at same time it's weird, because using the wallet-cli I can access the wallet without problems.

UPDATED 1

I noticed my newbie problem! I forgot to start the wallet-rpc with the option --rpc-login user:password but now the wallet has the result: { "id": "0", "jsonrpc": "2.0", "result": { "balance": 0, "unlocked_balance": 0 } } So the wallet is ok ! The problem in API continue and seems to be another thing Cheers

UPDATED 2

This screenshot is the result of --log-level 4 parameter without setting user:password command line during the starting process of monero-wallet-rpc and the API is really not connecting to the wallet.... screenshot from 2017-12-10 11-58-48

msilvoli commented 6 years ago

Hi @Vitorgamer58 Did you solve your problem with the API ? Cheers

ridd84 commented 6 years ago

Hi, I continue with my initial problem, any idea about it? any ubuntu log file to check? thanks

https://github.com/forknote/forknote-pool/issues/40#issue-271212909

vitorgamer58 commented 6 years ago

Hello, I did, thank you, sorry for coming back so late;

inzider commented 5 years ago

same here - can't upload the stats - API set to https://website.io:8117 and poolhost https://website.io -keep on updating.