adamwalach / openvpn-web-ui

Web interface (with golang backend) for monitoring and administration of OpenVPN server
MIT License
673 stars 274 forks source link

Handler crashed with error reflect: call of reflect.Value.Int on string Value #26

Open ramosisw opened 4 years ago

ramosisw commented 4 years ago

How can I solve this error? Environment Platform: Raspberry Pi 3 B + OS: linux Architecture: arm The source was compiled on the Raspberry Pi.

Action: Update the configuration of the default profile Initially I had to comment on that configuration in the code because it gave me the same error. Log

[ORM]2019/09/27 15:15:01  -[Queries/default] - [  OK / db.QueryRow /     0.2ms] - [SELECT `id`, `profile`, `port`, `proto`, `ca`, `cert`, `key`, `cipher`, `keysize`, `auth`, `dh`, `server`, `ifconfig_pool_persist`, `keepalive`, `max_clients`, `management` FROM `o_v_config` WHERE `profile` = ? ] - `default`
2019/09/27 15:15:01 [D] [utils.go:49] {
,
    "Profile": "default",
    "Port": 0,
    "Proto": "",
    "Ca": "",
    "Cert": "",
    "Key": "",
    "Cipher": "",
    "Keysize": 0,
    "Auth": "",
    "Dh": "",
    "Server": "",
    "IfconfigPoolPersist": "",
    "Keepalive": "",
    "MaxClients": 0,
    "Management": ""
} 
2019/09/27 15:15:01 [C] [panic.go:679] the request url is  /ov/config
2019/09/27 15:15:01 [C] [panic.go:679] Handler crashed with error reflect: call of reflect.Value.Int on string Value
2019/09/27 15:15:01 [C] [panic.go:679] /usr/local/go/src/runtime/panic.go:679
2019/09/27 15:15:01 [C] [panic.go:679] /usr/local/go/src/reflect/value.go:986
2019/09/27 15:15:01 [C] [panic.go:679] /go/src/github.com/adamwalach/openvpn-web-ui/vendor/github.com/astaxie/beego/orm/db.go:214
2019/09/27 15:15:01 [C] [panic.go:679] /go/src/github.com/adamwalach/openvpn-web-ui/vendor/github.com/astaxie/beego/orm/db.go:92
2019/09/27 15:15:01 [C] [panic.go:679] /go/src/github.com/adamwalach/openvpn-web-ui/vendor/github.com/astaxie/beego/orm/db.go:617
2019/09/27 15:15:01 [C] [panic.go:679] /go/src/github.com/adamwalach/openvpn-web-ui/vendor/github.com/astaxie/beego/orm/orm.go:239
2019/09/27 15:15:01 [C] [panic.go:679] /go/src/github.com/adamwalach/openvpn-web-ui/controllers/ovconfig.go:61
2019/09/27 15:15:01 [C] [panic.go:679] /go/src/github.com/adamwalach/openvpn-web-ui/vendor/github.com/astaxie/beego/router.go:787
2019/09/27 15:15:01 [C] [panic.go:679] /usr/local/go/src/net/http/server.go:2802
2019/09/27 15:15:01 [C] [panic.go:679] /usr/local/go/src/net/http/server.go:1890
2019/09/27 15:15:01 [C] [panic.go:679] /usr/local/go/src/runtime/asm_arm.s:868
d3vilh commented 2 years ago

have kind the same issue on RPI 4b:

ebat@netm:~/tempo $ cat /etc/debian_version
10.10
ebat@netm:~/tempo $ uname -a
Linux netm 5.10.60-v7l+ #1449 SMP Wed Aug 25 15:00:44 BST 2021 armv7l GNU/Linux

Managed to build everything for arm v71, but it can't run properly. DB seems on the place, instances and users were created, but it throws following, when I run it:

2021/10/01 12:12:56 [D] [models.go:88] {1 default openvpn:2080 tcp /etc/openvpn/ 127.0.0.1 2021-10-01 09:26:49.944566004 +0000 UTC 2021-10-01 09:26:49.944570911 +0000 UTC}
[ORM]2021/10/01 12:12:56  -[Queries/default] - [  OK / db.QueryRow /     0.1ms] - [SELECT `id`, `profile`, `port`, `proto`, `ca`, `cert`, `key`, `cipher`, `keysize`, `auth`, `dh`, `server`, `ifconfig_pool_persist`, `keepalive`, `max_clients`, `management` FROM `o_v_config` WHERE `profile` = ? ] - `default`
panic: reflect: call of reflect.Value.Int on string Value

goroutine 1 [running]:
reflect.Value.Int(...)
    /usr/local/go/src/reflect/value.go:1334

Update: As a WA you can disable default profile configuration submit to o_v_config table by commenting out createDefaultOVConfig() function as part of init() in models.go:

func init() {
    initDB()
    createDefaultUsers()
    createDefaultSettings()
//  createDefaultOVConfig()
}

This will skip createDefaultOVConfig and web server starts normally.