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

Source database "template1" is being accessed by other users #77

Open
mohamedanees6 opened this issue Apr 9, 2019 · 5 comments
Open

Comments

@mohamedanees6
Copy link

mohamedanees6 commented Apr 9, 2019

Am using postgres (PostgreSQL) 9.3.24 and installed(also, init) stellar.

I am getting this error whenever I try to take a snapshot

Traceback (most recent call last):
File "/usr/local/bin/stellar", line 9, in
load_entry_point('stellar==0.4.5', 'console_scripts', 'stellar')()
File "/Library/Python/2.7/site-packages/stellar/command.py", line 279, in main
stellar()
File "/Library/Python/2.7/site-packages/click/core.py", line 764, in call
return self.main(*args, **kwargs)
File "/Library/Python/2.7/site-packages/click/core.py", line 717, in main
rv = self.invoke(ctx)
File "/Library/Python/2.7/site-packages/click/core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/Library/Python/2.7/site-packages/click/core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/Library/Python/2.7/site-packages/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/Library/Python/2.7/site-packages/stellar/command.py", line 60, in snapshot
app = get_app()
File "/Library/Python/2.7/site-packages/stellar/command.py", line 28, in get_app
app = Stellar()
File "/Library/Python/2.7/site-packages/stellar/app.py", line 45, in init
self.init_database()
File "/Library/Python/2.7/site-packages/stellar/app.py", line 64, in init_database
tables_missing = self.create_stellar_database()
File "/Library/Python/2.7/site-packages/stellar/app.py", line 72, in create_stellar_database
self.operations.create_database('stellar_data')
File "/Library/Python/2.7/site-packages/stellar/operations.py", line 57, in create_database
get_engine_url(raw_conn, database)
File "/Library/Python/2.7/site-packages/sqlalchemy_utils/functions/database.py", line 570, in create_database
result_proxy = engine.execute(text)
File "/Library/Python/2.7/site-packages/sqlalchemy/engine/base.py", line 2166, in execute
return connection.execute(statement, *multiparams, **params)
File "/Library/Python/2.7/site-packages/sqlalchemy/engine/base.py", line 982, in execute
return self.execute_text(object, multiparams, params)
File "/Library/Python/2.7/site-packages/sqlalchemy/engine/base.py", line 1155, in _execute_text
parameters,
File "/Library/Python/2.7/site-packages/sqlalchemy/engine/base.py", line 1248, in _execute_context
e, statement, parameters, cursor, context
File "/Library/Python/2.7/site-packages/sqlalchemy/engine/base.py", line 1466, in _handle_dbapi_exception
util.raise_from_cause(sqlalchemy_exception, exc_info)
File "/Library/Python/2.7/site-packages/sqlalchemy/util/compat.py", line 383, in raise_from_cause
reraise(type(exception), exception, tb=exc_tb, cause=cause)
File "/Library/Python/2.7/site-packages/sqlalchemy/engine/base.py", line 1244, in _execute_context
cursor, statement, parameters, context
File "/Library/Python/2.7/site-packages/sqlalchemy/engine/default.py", line 552, in do_execute
cursor.execute(statement, parameters)
sqlalchemy.exc.OperationalError: (psycopg2.OperationalError) source database "template1" is being accessed by other users
DETAIL: There is 1 other session using the database.

However, when I type in,

sudo ps aux | grep template1

mohamedanees 32492 0.0 0.0 4268020 788 s002 S+ 10:14AM 0:00.00 grep template1

I am unable to see any process using template1.

Any pointers to solve this? I tried restarting postgres, disabled pgAdmin. Still this problem exisits.

@joey999
Copy link

joey999 commented Jun 18, 2019

SQLAlchemy==1.2.5 and SQLAlchemy-Utils==0.33.1

@volkanunsal
Copy link

Same here.

@joey999 Does it work with those versions?

@catogonzalez
Copy link

I had the same issue and fixed by editing stellar.yaml and changing template1 in this line

url: 'postgresql://charlie@localhost:5432/template1'

for whatever db name you are using.

@leonelgalan
Copy link

Same here.

@joey999 Does it work with those versions?

It did for me after getting these errors.

@ramonakira
Copy link

SQLAlchemy==1.2.5 and SQLAlchemy-Utils==0.33.1

Thanks this works for me, but is actually a downgrade since I had the following versions installed:

SQLAlchemy==1.3.16
SQLAlchemy-Utils==0.36.5

Anyone have an idea why this works?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants