Skip to content
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

sql_exec_internal failed in check_osp_result_exists() #2006

Closed
dvppvd opened this issue Jun 8, 2023 · 2 comments · Fixed by #2044
Closed

sql_exec_internal failed in check_osp_result_exists() #2006

dvppvd opened this issue Jun 8, 2023 · 2 comments · Fixed by #2044
Labels
bug Something isn't working

Comments

@dvppvd
Copy link
Contributor

dvppvd commented Jun 8, 2023

Expected behavior

No error.

Actual behavior

The function check_osp_result_exists() generate a SQL statement without check for missing value for the severity and qod attributes (maybe because of NVT timed out), which may result in sql_exec_internal failed.

Steps to reproduce

  1. Run a scan.
  2. Check the logs.

GVM versions

gvm: 22.4.3~dev1

Logfiles

md manage:WARNING:2023-06-05 17h58.16 UTC:31409: sql_exec_internal: PQexec failed: ERROR:  syntax error at or near "and"
LINE 1: ....'    and port = 'general/tcp' and severity =     and qod = ...
                                                             ^
 (7)
md manage:WARNING:2023-06-05 17h58.16 UTC:31409: sql_exec_internal: SQL: SELECT EXISTS (SELECT * FROM results   WHERE report = 137 and hash_value = '405b3db5584b5e7eb7e40fc8b0b99732'    and host = '127.0.0.1' and hostname = ''    and type = 'Error Message' and description = 'NVT timed out after 320 seconds.'    and port = 'general/tcp' and severity =     and qod =  and path = '' );
md manage:WARNING:2023-06-05 17h58.16 UTC:31409: sql_x: sql_exec_internal failed
md manage:WARNING:2023-06-05 17h58.16 UTC:31409: manage_cleanup_process_error: Error exit, setting running task to Interrupted
md manage:WARNING:2023-06-05 17h58.16 UTC:31409: sql_exec_internal: PQexec failed: ERROR:  current transaction is aborted, commands ignored until end of transaction block
 (7)
md manage:WARNING:2023-06-05 17h58.16 UTC:31409: sql_exec_internal: SQL: UPDATE reports SET scan_run_status = 13 WHERE id = 137;
md manage:WARNING:2023-06-05 17h58.16 UTC:31409: sqlv: sql_exec_internal failed
@dvppvd dvppvd added the bug Something isn't working label Jun 8, 2023
@sed-ats
Copy link

sed-ats commented Jul 11, 2023

I get the same error

when running several tasks in which there are several hosts
in version gvmd 22.4.2 everything worked fine
GVM versions
Greenbone Vulnerability Manager 22.5.1
Manager DB revision 254

md manage:WARNING:2023-07-12 09h38.46 UTC:2355239: sql_exec_internal: PQexec failed: ERROR:  invalid input syntax for type integer: ""
LINE 1: ... 'general/tcp' and severity = '-3.0'    and qod = '' and pat...
                                                             ^
 (7)
md manage:WARNING:2023-07-12 09h38.46 UTC:2355239: sql_exec_internal: SQL: SELECT EXISTS (SELECT * FROM results   WHERE report = 1476 and hash_value = 'd2f47ef54343041889636ce3ff0cd381'    and host = '10.10.10.10' and hostname = ''    and type = 'Error Message' and description = 'NVT timed out after 60 seconds.'    and port = 'general/tcp' and severity = '-3.0'    and qod = '' and path = '' );
md manage:WARNING:2023-07-12 09h38.46 UTC:2355239: sql_x: sql_exec_internal failed
md manage:WARNING:2023-07-12 09h38.46 UTC:2355239: manage_cleanup_process_error: Error exit, setting running task to Interrupted
md manage:WARNING:2023-07-12 09h38.46 UTC:2355239: sql_exec_internal: PQexec failed: ERROR:  current transaction is aborted, commands ignored until end of transaction block
 (7)
md manage:WARNING:2023-07-12 09h38.46 UTC:2355239: sql_exec_internal: SQL: UPDATE reports SET scan_run_status = 13 WHERE id = 1476;
md manage:WARNING:2023-07-12 09h38.46 UTC:2355239: sqlv: sql_exec_internal failed

@dg1rtf
Copy link

dg1rtf commented Jul 12, 2023

Same in src/manage_sql.c: check_osp_result_exists
md manage:WARNING:2023-07-12 08h54.24 UTC:428416: sql_exec_internal: PQexec failed: ERROR: invalid input syntax for type integer: ""
LINE 1: ... and port = '' and severity = '-3.0' and qod = '' and pat...
^
(7)
md manage:WARNING:2023-07-12 08h54.24 UTC:428416: sql_exec_internal: SQL: SELECT EXISTS (SELECT * FROM results WHERE report = 423 and hash_value = '424e3e36a9b25bc7f5953f591e683215' and host = '' and hostname = '' and type = 'Error Message' and description = 'Scan process Failure' and port = '' and severity = '-3.0' and qod = '' and path = '' );
md manage:WARNING:2023-07-12 08h54.24 UTC:428416: sql_x: sql_exec_internal failed
md manage:WARNING:2023-07-12 08h54.24 UTC:428416: manage_cleanup_process_error: Error exit, setting running task to Interrupted

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants