-
Notifications
You must be signed in to change notification settings - Fork 136
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
MySQL server has gone away #121
Comments
This could be fixed with force connect check this maybe can help, i haven't encountered this issue maybe because of this |
Thx. Will check that. |
Thanks. I checked the code and this may work, and will reconnect you. But the problem I see is that the query data will be lost. The code that is calling these queries will not try to re-call it again. So you may end up with missing outputs or inputs in your database after reconnecting in I think for reconnection, the better place would be before the query is executed, i.e., where There can also be other reasons why the connection is failing, e.g., default settings in mysql/mariadb being inadequate.
I will try to investigate what's happening. Maybe mysql/mariadb logs will some info about that. |
No problem, i see, this could bring up some problems if it would miss outputs or inputs from mysql DB, but then, if the input gets missed, on a rescan it should be reeaded, because the rescan will find the imputs/outputs from blockchain's db, isn't it? let me know if you find a better way to deal with timeouts, thanks :) |
no problem and yes, would have to rescan to find missing txs/outputs/inputs. I just setup regular mariadb on my linux box, instead of using docker, and will try to get some logs out of it. |
I added openmonero/src/db/MySqlAccounts.cpp Lines 228 to 229 in 9e3b72f
There still can be a problem, but at least connection should not be dropped permanently. If I manually kill the connection in mariadb I get this, but then it reconnects:
In the current devel branch I also added Ctrl+C support to greacfully stop openmonero, and the logging got extended. |
You think this option is better then force connect that i've mentioned above? I have another issue: |
I think so. Its directly implemented in mysql++ and propagated to mysql. It's also recommended in mysql++ docs regarding the timeouts: https://tangentsoft.com/mysqlpp/doc/html/userman/tutorial.html#conn-timeout Will see how it will work. Can always remove it if its not helpful.
I had it maybe only once. It was also reported before: #97 This is one reason why Ctr+C was added. With it, openmoenro will close the lmdb's blockchain database that it opens for reading. You can see this when you run openmonero with
When you force close it, openmonero has no chance to close the lmdb which it opens and it seems to keep accumulating the open connections. Before I just deleting lmdb.lck (e.g. in home/mwo/.bitmonero/lmdb/lock.mdb) and it solved the problem in my case so that new one is created. Not sure about this though. Similar issue was also reported before for monero monero-project/monero#2741 with suggested solution.
How many is MANY? |
Send more than 126 different login request to openmonero and you will get the issue, let me know yes, now it actually closes properly, what if it gets killed? |
I see. Probably will need to rethink how lmdb is accessed in openmonero. At the moment, there will be 126 search tx threads accessing the lmdb at the same time. So maybe will have to implement some pooling when only few threads access lmdb at the same time, or move to using rpc to deamon instead of accessing lmdb directly.
Thank it will be like before, all connections, threads will be terminated immedietly. I think it's better to let the all threads, mysql and lmdb close properly when openmonero stops. |
rpc to daemon could solve the problem for good.
It means that someone will have to wait until the threads gets freed again, i think we should test them both |
rpc to daemon should also be much easier to implement, as the second possible solution would require major changes to architecture of openmonero. But rpc will also wont be simultaneous, as is needs also synchronization. |
I agree
Thats also true, but i think the best solution is the rpc to daemon, how is mymonero handling with many connections? I assume that they have over 126 consecutive login requests |
Don't know. Their backend is closed sourced. But from what I know they use But for mass scale, applications such as openmonero/mymonero are "easily" parallelized, as you can spin up, e.g., 10 instances of the backend and daemons, on 10 servers. One possible way of doing this with some details has already been proposed for openmonero: #95 (comment) |
Yes, that would be the best option, do you plan to implement RPC to DAEMON soon? And about more instances, that would be a good idea too, a system to sync all mysql db on all instances would solve the panic in users if they would see that the wallet syncs from 0 again |
Yes, though "soon" in monero world does not mean anything:-) But yes, this and mysql-thing will be the issues I will be focusing the most at present. When complete? No timeframe on this. Hopefully "soon":-) Just spin up new branch for that: https://github.com/moneroexamples/openmonero/tree/new_rpc So all new changes will be there for experimentation. |
Nice, i will merge it tomorrow morning and test out the branch, i will let you know if i face issues, thanks :) |
Not sure I will have there anything new for tomorrow, but this is the branch when the rpc changes will be taking place. No problem. Good you can provide extra info and much needed testing for openmonero. Thanks. |
Thank you for your hard work, i really like your projects and work, you can count on my help for testing out, i use openmonero for my project to, thanks for that :) |
I made a seprate issue for the LMDB readers limit: #127 |
Sometimes it happens. Don't know yet why.
Previously had simillar problem:
#10
The text was updated successfully, but these errors were encountered: