chop-dbhi / sql-agent

HTTP interface for executing ad-hoc SQL queries.
BSD 2-Clause "Simplified" License
93 stars 23 forks source link

Exits after several minutes #9

Closed PaulWalkerUK closed 6 years ago

PaulWalkerUK commented 7 years ago

I'm using sql-agent along with prometheus-sql. Sql-agent runs fine - but only for a few minutes, then it exits. I get the following output:

C:\hjmetrics\sql-agent>sql-agent.exe
2017/05/31 17:40:22 main.go:107: * Listening on localhost:5000...
Errors in file :
ORA-21500: internal error code, arguments: [17147], [0x6372098], [], [], [], [], [], []

----- Call Stack Trace -----
calling              call     entry                argument values in hex
location             type     point                (? means dubious value)
-------------------- -------- -------------------- ----------------------------
_skgudmp()+117       CALLrel  _kgdsdst()           68FEFF0 1 59CEB80 61E165D2
                                                   61E1676A 61E165D2
_kgeriv_int()+147    CALLreg  00000000             59CEB80 3
_kgeriv()+22         CALLrel  _kgeriv_int()        59CEB80 0 42FB 0 1 68FF0AC
_kgeric1()+20        CALLrel  _kgeriv()            59CEB80 0 42FB 1 68FF0AC
_kgherror()+223      CALLrel  _kgeric1()           59CEB80 0 42FB 2 6372098 0
__VInfreq__kgh_heap  CALLrel  _kgherror()          59CEB80 6FDA8AC 42FB 6372098
_sizes()+351
_kghrsp()+189        CALLrel  _kghfrmrg()          59CEB80 0 6FDA8AC 6372098 0
_kpuhhrsm()+198      CALLrel  _kghrsp()            59CEB80 6FDA8AC 6FD999C
_kpufhndl0()+529     CALLrel  _kpuhhrsm()          6FDA514 6FD999C
_kpufhndl()+13       CALLrel  _kpufhndl0()         6FDA514 4 0
_OCIHandleFree()+23  CALLrel  _kpufhndl()          6FDA514 4
_OCIHandleFree()+40  CALLptr  00000000             6FDA514 4
009635CD             CALLrel  009F9CF8             6FDA514 4 0 430301 2031EF74
                                                   2033C780
00000000             CALL???  00000000
068FFF31             CALLreg  00000000             6802AA4 6802AA4 0 0 20338280
                                                   0

call stack performance statistics:
total                  : 0.096000 sec
setup                  : 0.067000 sec
stack unwind           : 0.001000 sec
symbol translation     : 0.023000 sec
printing the call stack: 0.005000 sec
printing frame data    : 0.000000 sec
printing argument data : 0.000000 sec

----- End of Call Stack Trace -----

This occurred after about 10 minutes (I'm connecting to an Oracle database)

I've had to build it on Windows 7 using go install since I'm not using envirnment that has Docker available.

PaulWalkerUK commented 7 years ago

Having said that, more often than not, I don't get any error output - it just exits quietly. Whether that means there are 2 separate issues, or one issue that just exhibits differently, I have no idea, sorry.... This last time, it ran for for 25 minutes before quietly exiting...

bruth commented 7 years ago

I have not tested the program on Windows simply because I don't have a machine to test it on. I know a build with the Postgres driver has successfully worked, but have not tested with the other drivers.

This ORA-21500 implies an issue in the Oracle driver. Which database are needing to talk to? You change the cmd/sql-agent/main.go file and comment out the drivers you don't need and try rebuilding it.

PaulWalkerUK commented 7 years ago

I'm using Oracle 11.2.0.4. Don't worry about it, I'll try digging into further and see how far I get (I'm new to Go, so it'll be a learning experience!! 😉)

bruth commented 7 years ago

No problem at all! Please feel free to ask questions even if they appear to be Go-specific.

PaulWalkerUK commented 7 years ago

I never managed to get any further in establishing what was happening (though it looks more likely related to the number of queries run, rather than time). I've worked around it by running it as a service that will automatically restart if the application exits :smile:

Feel free to close this ticket if you like. Thanks

tonniekrijger commented 3 years ago

@PaulWalkerUK , can you please provide the instructions how you created a Windows binary and run it as a service?

PaulWalkerUK commented 3 years ago

I forget the details now, but once I'd built the exe, I probably used nssm to setup the service in Windows