theQRL / QRL

Quantum Resistant Ledger
https://theqrl.org/
MIT License
417 stars 109 forks source link

Illegal Hardware Instruction. Possibly related to hardware AES support? #1435

Closed happysmash27 closed 4 years ago

happysmash27 commented 6 years ago

Describe the bug When qrl_start is run, it gives an illegal hardware instruction.

To Reproduce Steps to reproduce the behavior:

  1. Type qrl_start
% qrl_start
2018-06-14 16:40:16,977|0.63.0|unsynced| INFO : grpc public service - started !
2018-06-14 16:40:16,982|0.63.0|unsynced| INFO : grpc admin service - started !
2018-06-14 16:40:16,983|0.63.0|unsynced| INFO : [TWISTED] P2PFactory starting on 9000
2018-06-14 16:40:16,984|0.63.0|unsynced| INFO : <<<Reconnecting to peer list: {'35.177.72.178:50550', '173.249.22.240:49474', '97.90.35.107:37128', '66.175.217.203:52236', '35.177.60.137:52934', '144.217.165.32:40534', '50.126.86.250:48566', '35.177.72.178:48382', '104.237.3.185:46416', '35.177.72.178:36278', '35.177.72.178:57280', '173.249.22.240:49270', '81.234.224.15:59130', '35.177.72.178:36250', '104.237.3.185:9000', '173.249.42.252:37970', '34.208.138.15:59532', '34.208.138.15:50748', '104.251.219.40', '54.183.99.59:58572', '173.249.22.240:50322', '66.175.217.203:52024', '97.90.35.107:49064', '50.126.86.250:46650', '35.177.72.178:57306', '81.234.224.15:34940', '104.251.219.215', '52.53.193.114:49934', '35.177.72.178:50524', '204.12.250.162:53940', '173.249.42.252:39750', '35.177.72.178:56060', '35.177.60.137', '173.249.42.252:47158', '81.234.224.15:34960', '104.237.3.185', '52.53.193.114:60666', '144.217.165.32:60174', '204.12.250.162:43574', '173.249.42.252:38830', '35.177.72.178:48356', '173.249.22.240:59842', '173.249.22.240:49890', '104.251.219.145', '35.177.60.137:9000', '54.183.99.59:58124'}
2018-06-14 16:40:17,009|0.63.0|unsynced| INFO : QRL blockchain ledger 0.63.0
2018-06-14 16:40:17,009|0.63.0|unsynced| INFO : mining/staking address None
2018-06-14 16:40:17,118|0.63.0|unsynced| INFO : 104.237.3.185 peers data received: {'104.237.3.185:9000', '54.183.99.59:36834', '81.240.156.108:51766', '66.175.217.203:45612', '34.208.138.15:41520', '204.12.250.162:33706', '173.249.42.252:36746', '66.175.217.203:44628', '66.175.217.203:44658', '173.249.22.240:46088', '97.90.35.107:44046', '35.177.60.137:9000', '66.175.217.203:45110', '24.99.220.249:47716'}
2018-06-14 16:40:17,118|0.63.0|unsynced| INFO : 104.237.3.185 version: 0+untagged.1.gecb87ad.dirty | genesis prev_headerhash b'Outside Context Problem'
2018-06-14 16:40:17,126|0.63.0|unsynced| INFO : 104.237.3.185 peers data received: {'97.90.35.107:44088', '104.237.3.185:9000', '54.183.99.59:36834', '81.240.156.108:51766', '66.175.217.203:45612', '34.208.138.15:41520', '204.12.250.162:33706', '173.249.42.252:36746', '66.175.217.203:44628', '66.175.217.203:44658', '173.249.22.240:46088', '97.90.35.107:44046', '35.177.60.137:9000', '66.175.217.203:45110', '24.99.220.249:47716'}
2018-06-14 16:40:17,161|0.63.0|unsynced| INFO : 104.237.3.185 version: 0+untagged.1.gecb87ad.dirty | genesis prev_headerhash b'Outside Context Problem'
2018-06-14 16:40:17,337|0.63.0|unsynced| INFO : 35.177.60.137 peers data received: {'104.237.3.185:40994', '173.249.42.252:38720', '81.240.156.108:54988', '54.183.99.59:36164', '173.249.22.240:44410', '24.99.220.249:38282', '5.132.191.125:55776', '97.90.35.107:56050', '35.177.60.137:39866', '204.12.250.162:50718', '34.208.138.15:35970', '24.99.220.249:38338', '35.177.60.137:9000', '54.183.99.59:34632'}
2018-06-14 16:40:17,338|0.63.0|unsynced| INFO : 35.177.60.137 version: 0.62.2+349.g2d8b48f.dirty | genesis prev_headerhash b'Outside Context Problem'
2018-06-14 16:40:17,340|0.63.0|unsynced| INFO : 35.177.60.137 peers data received: {'104.237.3.185:40994', '173.249.42.252:38720', '81.240.156.108:54988', '54.183.99.59:36164', '173.249.22.240:44410', '24.99.220.249:38282', '5.132.191.125:55776', '97.90.35.107:56026', '97.90.35.107:56050', '35.177.60.137:39866', '204.12.250.162:50718', '34.208.138.15:35970', '24.99.220.249:38338', '35.177.60.137:9000', '54.183.99.59:34632'}
2018-06-14 16:40:17,497|0.63.0|unsynced| INFO : 35.177.60.137 version: 0.62.2+349.g2d8b48f.dirty | genesis prev_headerhash b'Outside Context Problem'
2018-06-14 16:40:18,010|0.63.0|synced| INFO : Status changed to ESyncState.synced
2018-06-14 16:40:28,180|0.63.0|synced| INFO : <<<Fetching block: 1 from 35.177.60.137:9000
2018-06-14 16:40:28,335|0.63.0|synced| INFO : >>> Received Block #1 74dee521508e9ff8dfc2d0983f98a1e4ffc05299daa814cdd5f2957f258b0600
[2018-06-14 16:40:28] : Your CPU doesn't support hardware AES. Don't expect high hashrates.
zsh: illegal hardware instruction  qrl_start
~ % bash
~ $ qrl_start
2018-06-14 16:41:11,851|0.63.0|unsynced| INFO : grpc public service - started !
2018-06-14 16:41:11,852|0.63.0|unsynced| INFO : grpc admin service - started !
2018-06-14 16:41:11,853|0.63.0|unsynced| INFO : [TWISTED] P2PFactory starting on 9000
2018-06-14 16:41:11,854|0.63.0|unsynced| INFO : <<<Reconnecting to peer list: {'104.251.219.215', '104.237.3.185:46416', '104.251.219.145', '66.175.217.203:45612', '97.90.35.107:49064', '173.249.22.240:49270', '24.99.220.249:47716', '97.90.35.107:44088', '204.12.250.162:33706', '35.177.72.178:36250', '54.183.99.59:58572', '104.237.3.185:40994', '173.249.42.252:39750', '54.183.99.59:58124', '35.177.60.137', '35.177.60.137:52934', '104.237.3.185', '52.53.193.114:60666', '144.217.165.32:40534', '34.208.138.15:50748', '97.90.35.107:44046', '173.249.22.240:50322', '5.132.191.125:55776', '173.249.42.252:37970', '66.175.217.203:52024', '204.12.250.162:43574', '81.240.156.108:54988', '35.177.72.178:57280', '81.234.224.15:34960', '81.234.224.15:59130', '173.249.22.240:49474', '204.12.250.162:53940', '81.240.156.108:51766', '173.249.42.252:38720', '34.208.138.15:59532', '24.99.220.249:38282', '35.177.72.178:56060', '173.249.22.240:44410', '173.249.42.252:36746', '66.175.217.203:44628', '81.234.224.15:34940', '54.183.99.59:36834', '24.99.220.249:38338', '173.249.42.252:47158', '35.177.72.178:57306', '54.183.99.59:34632', '173.249.22.240:59842', '66.175.217.203:45110', '35.177.60.137:39866', '104.251.219.40', '66.175.217.203:44658', '54.183.99.59:36164', '66.175.217.203:52236', '50.126.86.250:46650', '97.90.35.107:56026', '204.12.250.162:50718', '97.90.35.107:37128', '35.177.72.178:48382', '173.249.42.252:38830', '35.177.72.178:48356', '35.177.72.178:50550', '35.177.72.178:36278', '173.249.22.240:46088', '34.208.138.15:35970', '35.177.72.178:50524', '50.126.86.250:48566', '35.177.60.137:9000', '52.53.193.114:49934', '97.90.35.107:56050', '144.217.165.32:60174', '173.249.22.240:49890', '34.208.138.15:41520', '104.237.3.185:9000'}
2018-06-14 16:41:11,891|0.63.0|unsynced| INFO : QRL blockchain ledger 0.63.0
2018-06-14 16:41:11,891|0.63.0|unsynced| INFO : mining/staking address None
2018-06-14 16:41:11,996|0.63.0|unsynced| INFO : 104.237.3.185 peers data received: {'173.249.22.240:46088', '66.175.217.203:45110', '66.175.217.203:45612', '24.99.220.249:47716', '173.249.42.252:36746', '204.12.250.162:33706', '66.175.217.203:44628', '66.175.217.203:44658', '34.208.138.15:41520', '104.237.3.185:9000', '54.183.99.59:36834', '81.240.156.108:51766', '97.90.35.107:44256', '35.177.60.137:9000'}
2018-06-14 16:41:11,997|0.63.0|unsynced| INFO : 104.237.3.185 version: 0+untagged.1.gecb87ad.dirty | genesis prev_headerhash b'Outside Context Problem'
2018-06-14 16:41:12,019|0.63.0|unsynced| INFO : 104.237.3.185 peers data received: {'173.249.22.240:46088', '66.175.217.203:45110', '66.175.217.203:45612', '24.99.220.249:47716', '173.249.42.252:36746', '204.12.250.162:33706', '66.175.217.203:44628', '66.175.217.203:44658', '34.208.138.15:41520', '104.237.3.185:9000', '97.90.35.107:44368', '54.183.99.59:36834', '81.240.156.108:51766', '97.90.35.107:44256', '35.177.60.137:9000'}
2018-06-14 16:41:12,020|0.63.0|unsynced| INFO : 104.237.3.185 version: 0+untagged.1.gecb87ad.dirty | genesis prev_headerhash b'Outside Context Problem'
2018-06-14 16:41:12,210|0.63.0|unsynced| INFO : 35.177.60.137 peers data received: {'173.249.42.252:38720', '54.183.99.59:34632', '35.177.60.137:39866', '104.237.3.185:40994', '5.132.191.125:55776', '97.90.35.107:56300', '173.249.22.240:44410', '54.183.99.59:36164', '81.240.156.108:54988', '97.90.35.107:56196', '34.208.138.15:35970', '24.99.220.249:38338', '204.12.250.162:50718', '35.177.60.137:9000', '24.99.220.249:38282'}
2018-06-14 16:41:12,211|0.63.0|unsynced| INFO : 35.177.60.137 version: 0.62.2+349.g2d8b48f.dirty | genesis prev_headerhash b'Outside Context Problem'
2018-06-14 16:41:12,212|0.63.0|unsynced| INFO : 35.177.60.137 peers data received: {'173.249.42.252:38720', '54.183.99.59:34632', '35.177.60.137:39866', '104.237.3.185:40994', '5.132.191.125:55776', '173.249.22.240:44410', '54.183.99.59:36164', '81.240.156.108:54988', '97.90.35.107:56196', '34.208.138.15:35970', '24.99.220.249:38338', '204.12.250.162:50718', '35.177.60.137:9000', '24.99.220.249:38282'}
2018-06-14 16:41:12,213|0.63.0|unsynced| INFO : 35.177.60.137 version: 0.62.2+349.g2d8b48f.dirty | genesis prev_headerhash b'Outside Context Problem'
2018-06-14 16:41:12,891|0.63.0|synced| INFO : Status changed to ESyncState.synced
2018-06-14 16:41:53,111|0.63.0|synced| INFO : <<<Fetching block: 1 from 35.177.60.137:9000
2018-06-14 16:41:53,268|0.63.0|synced| INFO : >>> Received Block #1 74dee521508e9ff8dfc2d0983f98a1e4ffc05299daa814cdd5f2957f258b0600
[2018-06-14 16:41:53] : Your CPU doesn't support hardware AES. Don't expect high hashrates.
Miskomando

Expected behavior The QRL daemon starts

Desktop (please complete the following information):

Additional context I will try updating the QRL dependency libraries to see if it helps. "Miskomando" roughly means "bad command" in Esperanto, if you are wondering.

happysmash27 commented 6 years ago

After updating, I still get the same result:

~ $ qrl_start
2018-06-14 16:55:40,271|0.63.0|unsynced| INFO : grpc public service - started !
2018-06-14 16:55:40,272|0.63.0|unsynced| INFO : grpc admin service - started !
2018-06-14 16:55:40,272|0.63.0|unsynced| INFO : [TWISTED] P2PFactory starting on 9000
2018-06-14 16:55:40,273|0.63.0|unsynced| INFO : <<<Reconnecting to peer list: {'173.249.22.240:49890', '144.217.165.32:40534', '35.177.72.178:57306', '104.251.219.145', '173.249.42.252:38720', '35.177.72.178:50550', '173.249.22.240:50322', '97.90.35.107:56196', '35.177.72.178:36250', '173.249.42.252:36746', '66.175.217.203:44628', '35.177.72.178:36278', '97.90.35.107:44256', '52.53.193.114:60666', '81.234.224.15:59130', '97.90.35.107:44046', '35.177.72.178:56060', '66.175.217.203:52024', '50.126.86.250:48566', '173.249.22.240:44410', '54.183.99.59:36834', '204.12.250.162:50718', '34.208.138.15:50748', '97.90.35.107:56026', '204.12.250.162:53940', '66.175.217.203:45612', '173.249.42.252:38830', '173.249.22.240:49270', '104.251.219.215', '81.234.224.15:34940', '54.183.99.59:36164', '24.99.220.249:38282', '173.249.42.252:39750', '35.177.72.178:48382', '35.177.60.137:9000', '54.183.99.59:58572', '66.175.217.203:45110', '24.99.220.249:38338', '97.90.35.107:56300', '104.251.219.40', '35.177.72.178:50524', '34.208.138.15:41520', '35.177.60.137:52934', '54.183.99.59:58124', '204.12.250.162:43574', '34.208.138.15:59532', '97.90.35.107:49064', '81.240.156.108:54988', '54.183.99.59:34632', '173.249.22.240:59842', '173.249.42.252:37970', '35.177.72.178:48356', '66.175.217.203:52236', '35.177.72.178:57280', '144.217.165.32:60174', '35.177.60.137:39866', '97.90.35.107:44088', '97.90.35.107:44368', '173.249.22.240:49474', '97.90.35.107:56050', '50.126.86.250:46650', '173.249.22.240:46088', '104.237.3.185:9000', '5.132.191.125:55776', '66.175.217.203:44658', '97.90.35.107:37128', '104.237.3.185:40994', '52.53.193.114:49934', '81.240.156.108:51766', '35.177.60.137', '204.12.250.162:33706', '173.249.42.252:47158', '81.234.224.15:34960', '24.99.220.249:47716', '104.237.3.185:46416', '104.237.3.185', '34.208.138.15:35970'}
2018-06-14 16:55:40,315|0.63.0|unsynced| INFO : QRL blockchain ledger 0.63.0
2018-06-14 16:55:40,315|0.63.0|unsynced| INFO : mining/staking address None
2018-06-14 16:55:40,429|0.63.0|unsynced| INFO : 104.237.3.185 peers data received: {'66.175.217.203:44628', '24.99.220.249:47716', '35.177.60.137:9000', '204.12.250.162:33706', '66.175.217.203:45612', '81.240.156.108:51766', '66.175.217.203:45110', '97.90.35.107:44716', '34.208.138.15:41520', '173.249.42.252:36746', '149.210.161.156:40560', '54.183.99.59:36834', '173.249.22.240:46088', '66.175.217.203:44658', '104.237.3.185:9000', '149.210.161.156:40746'}
2018-06-14 16:55:40,430|0.63.0|unsynced| INFO : 104.237.3.185 version: 0+untagged.1.gecb87ad.dirty | genesis prev_headerhash b'Outside Context Problem'
2018-06-14 16:55:40,437|0.63.0|unsynced| INFO : 104.237.3.185 peers data received: {'66.175.217.203:44628', '24.99.220.249:47716', '35.177.60.137:9000', '204.12.250.162:33706', '66.175.217.203:45612', '81.240.156.108:51766', '97.90.35.107:44742', '97.90.35.107:44716', '66.175.217.203:45110', '34.208.138.15:41520', '173.249.42.252:36746', '149.210.161.156:40560', '54.183.99.59:36834', '173.249.22.240:46088', '66.175.217.203:44658', '104.237.3.185:9000', '149.210.161.156:40746'}
2018-06-14 16:55:40,438|0.63.0|unsynced| INFO : 104.237.3.185 version: 0+untagged.1.gecb87ad.dirty | genesis prev_headerhash b'Outside Context Problem'
2018-06-14 16:55:40,629|0.63.0|unsynced| INFO : 35.177.60.137 peers data received: {'149.210.161.156:40692', '54.183.99.59:36164', '24.99.220.249:38282', '104.237.3.185:40994', '204.12.250.162:50718', '35.177.60.137:9000', '35.177.60.137:39866', '81.240.156.108:54988', '24.99.220.249:38338', '173.249.42.252:38720', '54.183.99.59:34632', '173.249.22.240:44410', '34.208.138.15:35970', '97.90.35.107:56674', '5.132.191.125:55776'}
2018-06-14 16:55:40,642|0.63.0|unsynced| INFO : 35.177.60.137 peers data received: {'149.210.161.156:40692', '54.183.99.59:36164', '24.99.220.249:38282', '104.237.3.185:40994', '204.12.250.162:50718', '35.177.60.137:9000', '35.177.60.137:39866', '81.240.156.108:54988', '24.99.220.249:38338', '173.249.42.252:38720', '97.90.35.107:56604', '54.183.99.59:34632', '173.249.22.240:44410', '34.208.138.15:35970', '97.90.35.107:56674', '5.132.191.125:55776'}
2018-06-14 16:55:40,643|0.63.0|unsynced| INFO : 35.177.60.137 version: 0.62.2+349.g2d8b48f.dirty | genesis prev_headerhash b'Outside Context Problem'
2018-06-14 16:55:40,783|0.63.0|unsynced| INFO : 35.177.60.137 version: 0.62.2+349.g2d8b48f.dirty | genesis prev_headerhash b'Outside Context Problem'
2018-06-14 16:55:41,315|0.63.0|synced| INFO : Status changed to ESyncState.synced
2018-06-14 16:56:21,348|0.63.0|synced| INFO : <<<Fetching block: 1 from 104.237.3.185:9000
2018-06-14 16:56:21,398|0.63.0|synced| INFO : >>> Received Block #1 74dee521508e9ff8dfc2d0983f98a1e4ffc05299daa814cdd5f2957f258b0600
[2018-06-14 16:56:21] : Your CPU doesn't support hardware AES. Don't expect high hashrates.
Miskomando
~ $ pip search qrl
qrl (0.63.0)             - Quantum Resistant Ledger Node
  INSTALLED: 0.63.0 (latest)
pyqrllib (0.9.11)        - QRL core library
  INSTALLED: 0.9.11 (latest)
pyqryptonight (0.10.10)  - QRL cryptonight library
  INSTALLED: 0.10.10 (latest)
happysmash27 commented 6 years ago

It appears that my kernel has AES support too:

2018-06-14-170508_1280x998_scrot

Edit: This also applies to the kernel I am actually using:

2018-06-14-170826_1280x998_scrot

Edit 2: cat /proc/crypto appears to show it as loaded too (output truncated because it is very long):

name         : aes
driver       : aes-asm
module       : kernel
priority     : 200
refcnt       : 15
selftest     : passed
internal     : no
type         : cipher
blocksize    : 16
min keysize  : 16
max keysize  : 32

Also:

 # cat /proc/crypto|grep aes
name         : cmac(aes)
driver       : cmac(aes-asm)
name         : ccm(aes)
driver       : ccm_base(ctr(aes-asm),cbcmac(aes-asm))
name         : ctr(aes)
driver       : ctr(aes-asm)
name         : cbcmac(aes)
driver       : cbcmac(aes-asm)
name         : xts(aes)
driver       : xts(ecb(aes-asm))
name         : ecb(aes)
driver       : ecb(aes-asm)
name         : cbc(aes)
driver       : cbc(aes-asm)
name         : aes
driver       : aes-generic
name         : aes
driver       : aes-asm
happysmash27 commented 6 years ago

Okay, this is interesting. I decided to run it through Valgrind, and although it has loads of errors, it does not crash this time:

https://pastebin.com/JFJpttXs

randomshinichi commented 6 years ago

It's not about which ciphers your kernel supports. You need a CPU with AES-NI.

I see you're running a Nehalem! real classic. Unfortunately it doesn't have AES-NI...

happysmash27 commented 6 years ago

Regardless of acceleration, how can I get it to not crash (other than possibly running it with Valgrind)?

Edit: As in, how can I one it to stop running the illegal hardware instruction and ignore hardware acceleration instead? PS: Looking at the log again, it appears that Valgrind has tricked it into using software cryptography as hardware cryptography. The warning message said that hashrates will be slower, not that it will crash altogether!

randomshinichi commented 6 years ago

The error message is misleading. It says "don't expect high hashrates" but the fact is pyqryptonight will always crash if you don't have AES-NI. There is no alternate codepath - a patch would be welcome though!

jleni commented 6 years ago

This is related to https://github.com/theQRL/qryptonight/issues/29

We had some contribution but it was adding some instability at the time. We need to find the time to understand what is the reason the PR was generating these problems. Hopefully someone can contribute to the ticket.

In the meantime, the alternatives are: