Tuesday, March 6, 2018

postgresql error : ERROR: database is being accessed by other users

ERROR:  database "X" is being accessed by other users
DETAIL:  There is 1 other session using the database


Solution :
SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE pid <> pg_backend_pid() AND datname = 'database-name';
You need to replace only database name in above query.

Now you can drop the database or perform other activity what you were trying to perform.

composer update - exceeded the timeout of 300 seconds

Failed to download from source: The process  exceeded the timeout of 300 seconds.

Solution :
Increase the timeout limit globally for composer
composer --global config process-timeout 6000
Now run
composer update
You should not get timeout issue.

gitlab forbidden issue

This feature has been added by default in recent update of gitlab.
When there are number of failed login attempts while cloning or pushing files into gitlab repository, gitlab blocks UI as well as pull and push for the IP. Technically, it bans the IP.

Solution :
Disable this feature.

sudo nano /etc/gitlab/gitlab.rb
Uncomment these lines.
gitlab_rails['rack_attack_git_basic_auth'] = {
'enabled' => false,
}
Reconfigure gitlab.
sudo gitlab-ctl reconfigure
Now it will not block that ip after number of failed login attempts.