Bench Restart giving errors

I have a custom app on my local instance and I have been making some changes into that. Not sure if the error is related to that.

Even though, the bench update and bench migrate are happening properly, I am not able to see the changes reflected from the app, where I have made some changes. And, when I am running bench restart, I am getting these following errors:

frappe-bench-node-socketio: stopped
frappe-bench-frappe-web: stopped
frappe-bench-frappe-async-worker: ERROR (abnormal termination)
frappe-bench-frappe-longjob-worker: ERROR (abnormal termination)
frappe-bench-frappe-workerbeat: ERROR (abnormal termination)
frappe-bench-frappe-worker: ERROR (abnormal termination)
frappe-bench-node-socketio: started
frappe-bench-frappe-web: started

Is it because of these errors that my custom code is not reflecting the changes? Further, when I checked the worker.error.log, I am seeing these lines:

/home/umag/frappe-bench/env/bin/python: No module named frappe.celery_app

What should I do? Why is it not able to find celery_app file? Please help.

Thanks
Uma

1 Like

Have you switched to development branches?

No, I had downloaded the master version while setting up ERPNEXT, and the sites are running without my having to do a bench start every time. So, I guess it is still in the master branch only.

Can you go into the frappe and erpnext folders, run git status and paste the outputs here?

This is the output:

umag@epochuma:~/frappe-bench/apps/frappe$ git status
On branch develop
Your branch is up-to-date with ‘upstream/develop’.

nothing to commit, working directory clean

Does it mean that it is in developer mode? But, I had done a clean installation with --setup-production

From one of your previous posts related to this, I see that you have given these instructions:

bench use [your-site]
bench switch-to-master
Run bench mysql. You should get in the SQL shell
Run ALTER TABLE tabDocType DROP COLUMN track_seen;
And then run ALTER TABLE tabDocType DROP COLUMN quick_entry;
Exit the SQL shell, and run bench update

Should I also be following these instructions because I would like to retain my site?

Thanks
Uma

Reply as linked Topic

I’m not sure how, but somehow you’ve changed the branches of your apps. You can put them back to master by running git checkout master inside the app folders. Check your erpnext folder as well, to see if it’s on the right branch.

Once you run those, run :

bench migrate
bench setup supervisor
sudo supervisorctl reread
bench restart

If you wish to stay on develop branches and fix the issue just run the four commands above.

Thanks for the quick response @vjFaLk… I ran the git checkout master inside the apps folder and then when I tried to run bench migrate, I am getting these following errors:

Migrating pppltest
Updating frappe : [= ]Traceback (most recent call last):
File “/usr/lib/python2.7/runpy.py”, line 162, in _run_module_as_main
main”, fname, loader, pkg_name)
File “/usr/lib/python2.7/runpy.py”, line 72, in _run_code
exec code in run_globals
File “/home/umag/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 79, in
main()
File “/home/umag/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 16, in main
click.Group(commands=commands)(prog_name=‘bench’)
File “/home/umag/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 716, in call
return self.main(*args, **kwargs)
File “/home/umag/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 696, in main
rv = self.invoke(ctx)
File “/home/umag/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/umag/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/umag/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 889, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/umag/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 534, in invoke
return callback(*args, **kwargs)
File “/home/umag/frappe-bench/env/local/lib/python2.7/site-packages/click/decorators.py”, line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File “/home/umag/frappe-bench/apps/frappe/frappe/commands/init.py”, line 24, in _func
File “/home/umag/frappe-bench/apps/frappe/frappe/commands/site.py”, line 182, in migrate
if reset:
File “/home/umag/frappe-bench/apps/frappe/frappe/migrate.py”, line 29, in migrate
frappe.model.sync.sync_all(verbose=verbose)
File “/home/umag/frappe-bench/apps/frappe/frappe/model/sync.py”, line 19, in sync_all
sync_for(app, force, verbose=verbose)
File “/home/umag/frappe-bench/apps/frappe/frappe/model/sync.py”, line 43, in sync_for
import_file_by_path(doc_path, force=force)
File “/home/umag/frappe-bench/apps/frappe/frappe/modules/import_file.py”, line 54, in import_file_by_path
import_doc(doc, force=force, data_import=data_import, pre_process=pre_process)
File “/home/umag/frappe-bench/apps/frappe/frappe/modules/import_file.py”, line 122, in import_doc
doc.insert()
File “/home/umag/frappe-bench/apps/frappe/frappe/model/document.py”, line 203, in insert
self.db_insert()
File “/home/umag/frappe-bench/apps/frappe/frappe/model/base_document.py”, line 282, in db_insert
), d.values())
File “/home/umag/frappe-bench/apps/frappe/frappe/database.py”, line 136, in sql
self._cursor.execute(query, values)
File “/home/umag/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/cursors.py”, line 205, in execute
self.errorhandler(self, exc, value)
File “/home/umag/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/connections.py”, line 36, in defaulterrorhandler
raise errorclass, errorvalue
_mysql_exceptions.OperationalError: (1048, “Column ‘image_view’ cannot be null”)

When I got this error, I ran the commands:

ALTER TABLE tabDocType DROP COLUMN image_view;
ALTER TABLE tabDocType DROP COLUMN track_seen;
ALTER TABLE tabDocType DROP COLUMN quick_entry;

based on the following suggestions… Now, I am getting this error:
_mysql_exceptions.OperationalError: (1048, “Column ‘editable_grid’ cannot be null”)

Should I continue to drop columns from tabDocType as per the errors?

Okay, it seems you previously moved to the develop branch and then ran migrations. I wouldn’t recommend trying to solve every database problem that comes up. So, you can either move back to develop, and run those commands again. Or if you don’t have any significant data in your site, you can just create a new site.

Hi @vjFaLk,

As nothing seemed to work, I tried reinstalling the whole thing again after deleting all the apps and sites. In fact, I deleted the entire folder of frappe-bench and bench-repo before doing the re-install, like I do always. So, I ran the

sudo bash setup_frappe.sh –setup-production

on my frappe-bench and the whole installation went through successfully. But, when I went to check out the apps and did a git status on the erpnext and frappe folders, it is again showing upstream/develop. And, these apps get created on their own while I do the installation. So, I am wondering why the apps are on develop while the entire frappe install is for production.

So, before I proceed on my custom apps and face other issues, wanted to check with you if this is fine.

Am I doing anything wrong? Please help.

Thanks
Uma

That’s actually quite odd. Sorry for the trouble, I’ll look into it. I’d suggest using the new installer : GitHub - frappe/bench: CLI to manage Multi-tenant deployments for Frappe apps next time.

For now you can just change the branches for both the apps to master and create a new site by running:

bench new-site [site-name]

And then to make this new site as the default site:

bench use [site-name]

Followed by bench restart