question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SQL exception in file-server

See original GitHub issue

I can’t seem to get workers to pick up jobs from the worklist.

Expected Behavior

Docker image works out of the box, workers pick up tasks from worklist.

Current Behavior

Exceptions in file-server are thrown.
Workers are not picking up tasks from worklist.

Steps to Reproduce (for bugs)

  1. Build and start docker image as described in https://github.com/owtf/owtf-docker
  2. Add target and a run a plugin (add something to the worklist)

Logs

  1. Connect to container via docker run -it <container_name> bash
  2. Check file-server log via tail -f /tmp/owtf/file_server.log.
StatementError: (sqlalchemy.exc.InvalidRequestError) Can't reconnect until invalid transaction is rolled back [SQL: u'SELECT configuration.key AS configuration_key, configuration.value AS configuration_value, configuration.section AS configuration_section, configuration.descrip AS configuration_descrip, configuration.dirty AS configuration_dirty \nFROM configuration \nWHERE configuration.key = %(param_1)s'] [parameters: [{'%(139842964893904 param)s': 'MIN_RAM_NEEDED'}]]
[E 170508 12:25:06 ioloop:638] Exception in callback <bound method WorkerManager.manage_workers of <framework.plugin.worker_manager.WorkerManager instance at 0x7f2fba432758>>
    Traceback (most recent call last):
      File "/root/.virtualenvs/owtf/lib/python2.7/site-packages/tornado/ioloop.py", line 1026, in _run
        return self.callback()
      File "/owtf/framework/plugin/worker_manager.py", line 124, in manage_workers
        work_to_assign = self.get_task()
      File "/owtf/framework/plugin/worker_manager.py", line 69, in get_task
        if int(free_mem) > int(self.db_config.Get('MIN_RAM_NEEDED')):
      File "/owtf/framework/db/config_manager.py", line 52, in Get
        obj = self.db.session.query(models.ConfigSetting).get(Key)
      File "/root/.virtualenvs/owtf/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 864, in get
        return self._get_impl(ident, loading.load_on_ident)
      File "/root/.virtualenvs/owtf/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 897, in _get_impl
        return fallback_fn(self, key)
      File "/root/.virtualenvs/owtf/lib/python2.7/site-packages/sqlalchemy/orm/loading.py", line 223, in load_on_ident
        return q.one()
      File "/root/.virtualenvs/owtf/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 2814, in one
        ret = self.one_or_none()
      File "/root/.virtualenvs/owtf/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 2784, in one_or_none
        ret = list(self)
      File "/root/.virtualenvs/owtf/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 2855, in __iter__
        return self._execute_and_instances(context)
      File "/root/.virtualenvs/owtf/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 2878, in _execute_and_instances
        result = conn.execute(querycontext.statement, self._params)
      File "/root/.virtualenvs/owtf/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 945, in execute
        return meth(self, multiparams, params)
      File "/root/.virtualenvs/owtf/lib/python2.7/site-packages/sqlalchemy/sql/elements.py", line 263, in _execute_on_connection
        return connection._execute_clauseelement(self, multiparams, params)
      File "/root/.virtualenvs/owtf/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1053, in _execute_clauseelement
        compiled_sql, distilled_params
      File "/root/.virtualenvs/owtf/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1121, in _execute_context
        None, None)
      File "/root/.virtualenvs/owtf/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1402, in _handle_dbapi_exception
        exc_info
      File "/root/.virtualenvs/owtf/lib/python2.7/site-packages/sqlalchemy/util/compat.py", line 203, in raise_from_cause
        reraise(type(exception), exception, tb=exc_tb, cause=cause)
      File "/root/.virtualenvs/owtf/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1114, in _execute_context
        conn = self._revalidate_connection()
      File "/root/.virtualenvs/owtf/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 424, in _revalidate_connection
        "Can't reconnect until invalid "

OWTF started without errors:

docker run -it -p 8008:8008 -p 8009:8009 -p 8010:8010 owtf-master /bin/bash
Starting the postgresql service
[ ok ] Starting PostgreSQL 9.6 database server: main.
CREATE ROLE
CREATE DATABASE

 _____ _ _ _ _____ _____
|     | | | |_   _|   __|
|  |  | | | | | | |   __|
|_____|_____| |_| |__|

        @owtfp
    http://owtf.org
    
[*] OWTF Version: 2.1a, Release: Chicken Korma (Alpha) 
[-] Loading framework please wait..
[-] Loading Resources from: /root/.owtf/configuration/resources.cfg..
[-] Loading Mapping from: /root/.owtf/configuration/mappings.cfg..
[*] 0.0.0.0:8008 <-- HTTP(S) Proxy to which requests can be directed
[*] http://0.0.0.0:8009 <-- Web UI URL
[-] Press Ctrl+C when you spawned a shell ;)

Your Environment

  • Installation method used: Docker
  • Version/branch used: develop
  • Operating System and version: macOS Sierra
  • Docker Memory limit: 2GB
  • pip/setuptools version:
  • sudo access:

What am I missing?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:13 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
viyatbcommented, May 23, 2017

@jaylinski I think the problem is with ssl=true in the postgresql.conf. I’ll add it to the postgres_entry.sh tonight.

1reaction
viyatbcommented, May 16, 2017

@jaylinski ok, let me try that 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Fail to bring file server role online - TechNet - Microsoft
I have add the file server role on the cluster(server 2012). But cannot bring it online. I have the following error. Event ID...
Read more >
SQL error log can't create/write to file - Server Fault
I'm running WordPress on a developer plan VPS over at media temple (meaning I have root access, everything is managed by me etc)....
Read more >
Error occurred while bringing file server resource online - Rules
In the center pane, right-click the Server service, and then click. View the status of the service. If needed, start or restart the...
Read more >
Attachment file \\SERVER\file.csv is invalid. [SQLSTATE ...
Run the RECONFIGURE statement to install. [SQLSTATE 01000] (Message 15457) Attachment file \\ServerName\ShareName\Path\SQL2012_DB.csv is invalid ...
Read more >
issues with connecting to Laserfiche server when SQL or File ...
Whenever our file server or domain controller is restarted ... The SQL error appears to have been after our SQL server was restarted....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found