|
|
|
# Description of the issue
|
|
|
|
Electrumx has one critical issue(https://github.com/kyuupichan/electrumx/issues/185), when servers started to get desynchronized with Crown chain after about a month of work and Electrum Crown wallet start to show that server is lagging
|
|
|
|
![electrumx_lagging](/uploads/3ffeb34ef4d52f394c3d24991783a731/electrumx_lagging.PNG)
|
|
|
|
|
|
|
|
Please note that on this problem is currently working Electrumx creator, so I will import changes after the final fix is done.
|
|
|
|
But for now we need to maintain servers as soon as the problem occurs.
|
|
|
|
|
|
|
|
|
|
|
|
# Identification of issue
|
|
|
|
To be sure that you have the same problem as described in the issue above do the following steps:
|
|
|
|
1. Type the following command to show server logs
|
|
|
|
```
|
|
|
|
journalctl -u electrumx.service --no-pager -n 100
|
|
|
|
```
|
|
|
|
where `electrumx.service` is the service name and it can be different for your case
|
|
|
|
2. You will see the following lines in the logs:
|
|
|
|
|
|
|
|
```
|
|
|
|
electrumx_server.py[1755]: flush_id = pack('>H', self.flush_count)
|
|
|
|
electrumx_server.py[1755]: struct.error: 'H' format requires 0 <= number <= 65535
|
|
|
|
```
|
|
|
|
|
|
|
|
# How to fix
|
|
|
|
The following actions is needed to bring servers into the working state
|
|
|
|
1. Download the python script from electrumx repo`(only python3.6 version is supported)`:
|
|
|
|
```
|
|
|
|
wget https://raw.githubusercontent.com/Crowndev/electrumx/crown/compact_history.py
|
|
|
|
```
|
|
|
|
|
|
|
|
2. Adapt it according to your configuration:
|
|
|
|
```
|
|
|
|
# Configure it for your case, the value should be the same as set in /etc/electrumx.conf
|
|
|
|
environ['DB_DIRECTORY'] = '/db'
|
|
|
|
```
|
|
|
|
As marked in comment the value of DB_DIRECTORY should be taken from electrumx config file, which is mainly located in /etc/electrumx.conf
|
|
|
|
|
|
|
|
3. Stop the electrumx server before running the script
|
|
|
|
```
|
|
|
|
systemctl stop electrumx.service
|
|
|
|
```
|
|
|
|
where `electrumx.service` is the service name
|
|
|
|
|
|
|
|
4. Run the script
|
|
|
|
```
|
|
|
|
python compact_history.py
|
|
|
|
```
|
|
|
|
wait untill the script is finished, it may take long(up to 6 hour, depends on hardware capability)
|
|
|
|
|
|
|
|
5. Rerun electrumx server
|
|
|
|
```
|
|
|
|
systemctl restart electrumx.service
|
|
|
|
```
|
|
|
|
6. Wait a minute and test that error lines are disappeared from the server log.
|
|
|
|
```
|
|
|
|
journalctl -u electrumx.service --no-pager -n 100
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|