Parcel watch doesn't detect changes, but safe-write is off - intellij-idea

Symptoms:
Starting parcel watch completes the initial build, the command continues running but doesn't detect any further changes
Context:
Parcel is being run from an IntelliJ IDEA platform IDE (Rider)
Safe-write functionality is disabled, so I am completely sure that the file is actually being changed on disk
Problem is reproducible when I edit referenced CSS or JS using a different editor (vim)
OS is Ubuntu Linux
Why aren't subsequent changes to files detected by Parcel, triggering a re-build?

FWIW, you can set up a file watcher inside intellij that runs touch on the file. Just make sure it doesn't trigger on external file changes, or you'll loop forever. This way, you can leave safe write on and still trigger parcel and other external watchers.

IntelliJ-based IDEs have a habit of completely burning through the inotify limit. In my case, setting fs.inotify.max_user_watches in /etc/sysctl.conf to a higher value (524288 in my case, in accordance with the instructions given by JetBrains) and then running sudo sysctl -p --system before restarting parcel watch solved the problem conclusively.

Related

Intellij GitToolBox Plugin Spawns dozens of ssh.exe that never close

I just started at a new company and they use Intellij with the GitToolBox plugin. Their code is on BitBucket. I seem to be able to do everything manually so I think Git and the SSH stuff is all connected. When I open Intellij it opens up a dozen or more ssh.exe and maxes out my CPU (i9) and will stay that way forever until I manually kill them. When I try to fetch it also runs forever and never shows progress or completes. I verified that it is indeed the GitToolBox plugin as this issue does not occur when I remove that plugin. I have tried older versions as well as adding/removing the plugin.
The only thing I can see in the Intellij logs are repo hash mismatch INFO messages and the following:
2021-08-16 14:04:36,198 [ 557785] WARN - nSystem.impl.ActionToolbarImpl - 'TodoViewToolbar' toolbar by default uses any focused component to update its actions. Toolbar actions that need local UI context would be incorrectly disabled. Please call toolbar.setTargetComponent() explicitly.
java.lang.Throwable: toolbar creation trace
And
2021-08-16 14:04:59,580 [ 581167] WARN - penapi.actionSystem.impl.Utils - Use DataManager.getDataContext(component) instead of SimpleDataContext for wrapping.
java.lang.Throwable: Use DataManager.getDataContext(component) instead of SimpleDataContext for wrapping.
Has anyone encountered this or know how to fix it?
For anyone that happens upon this issue, I installed Git For Windows incorrectly and was using the "Git Bash only" option instead of the "Command line and 3rd party apps" option during the initial install. To change these you have to completely uninstall g4w and reinstall it selecting the new options.

How to run a script from startup on Raspbian 10 (buster)?

I have designed a GUI that I want to run as soon as I turn on my Raspberry Pi. It is currently set up to automatically log in as user on startup, but if that makes the process more difficult I can change that. My Raspi runs on Raspbian 10 (buster), which has made things difficult since I can only find tutorials for Raspbian 8 or so.
I have tried modifying autostart folder, but it is not in the same location as it was in previous Raspbian versions and doesn't seem to be working the way it used to. Tutorials have said to create a .desktop file in /home/pi/.config/autostart but I don't have a .config folder, or at least it's hidden. For me, autostart is in /etc/xdg/autostart and when I try to create a new file here using nano in the terminal, I get the message [Directory '/etc/xdg/autostart' is not writable] and it doesn't save my file.
I have also tried calling my script in /etc/rc.local but it did nothing. Some have said it doesn't work for GUIs.
Here's what I type into terminal:
$ nano /etc/xdg/autostart/gui.desktop
and a new file pops up, but at the bottom I get the warning [Directory '/etc/xdg/autostart' is not writable]
How can I get my GUI script to run on startup with Raspbian 10 (buster)?
There are a number of issues here, first when you are looking at tutorials recognize that Linux distros are built in layers, for simplicity let's say your "layer stack" looks like this: kernel, systemd, x11, xdg, lxde. The kernel boots, then starts systemd, which then starts x11 (and a lot of other stuff), x11 starts xdg (and some other stuff, I think), lxde is started by either x11 or xdg I'm not sure which.
You want to add something to this process, you can do it at the kernel level (bad idea), at they systemd level (probably not right unless its a daemon), at the x11 level (still probably bad as you still don't have a user session yet), or at the xdg or lxde level.
xdg is probably the right place as it has all you need ( a gui, a user session) while being common (xdg will still work if you switch window managers, probably)
With that out of the way, why isn't your solution of modifying xdg working? It's because '/etc/xdg/autostart' is a system configuration directory. Any changes made to it will apply to all users. You may want this, but the system is trying to protect other users on your system and only allows root to make changes to everyone. If you want to do that use "sudo" (documented elsewhere on stack exchange and the internet). If you want to do it just for you use ~/.config/autostart, (https://wiki.archlinux.org/index.php/XDG_Autostart) you might need to create that directory with "mkdir ~/.config/" and then "emacs ~/.config/autostart"
Would it be better to have the python program run in a terminal window from startup? That way you would see what it is doing in case of errors.
If so, perhaps check this out https://stackoverflow.com/a/61730679/7575617
By the way, in the file manager, hit CTRL+H to toggle viewing hidden files and folders.

What text editors does --dev reload with work

I'm following Odoo's documentation to use the --dev all parameter when I run odoo-bin, in order to have Python models get updated when I change the source code without me having to restart the server. According to the documentation, the reload flag (which is part of all) doesn't work with some text editors. I've been using Sublime Text, and that doesn't seem to work because my model changes don't take effect until I restart the server. Is there a good, commonly used text editor which does work with the reload parameter, or is there a list of text editors which work with it?
If you're running Odoo from the command line via a standard ./odoo-bin --dev reload command then you should not have any issues as long as you have the lib dependencies setup.
Make sure to monitor your log for errors. It requires the watchdog library to be installed via pip install watchdog. Take a look at (currently line 943) of the core files https://github.com/odoo/odoo/blob/10.0/odoo/service/server.py to see how dev reload works:
def start(preload=None, stop=False):
...
watcher = None
if 'reload' in config['dev_mode']:
if watchdog:
watcher = FSWatcher()
watcher.start()
else:
_logger.warning("'watchdog' module not installed. Code autoreload feature is disabled")
if 'werkzeug' in config['dev_mode']:
server.app = DebuggedApplication(server.app, evalex=True)
I am not completely sure, but after doing a quick search on the text editor that I have been primarily using (Atom developed by GitHub), I believe it may have what you're looking for.
Have fun with your future endeavors. I hope my answer helps.
Since odoo uses werkzeug server,you can just use the command line argument to start the server, and everything will be taken care by the server.
./openerp-server --auto-reload
this will restart the server whenever .py file is modified.

pub serve not updating web unless I restart it

In IntelliJ there's a tab that says "Pub Serve", when I hit Ctrl + Shift + R, I can see plenty of output on the Pub Serve output terminal and it launches the Chromium that came with the Dart Editor displaying my web application.
Now if I make a change to any of the dart files or html files or even index.html and refresh in Chromium, I don't see the changes until I click the stop button on Pub Serve.
I've installed the JetBrains plugin in Chromium to see if it makes a difference, non whatsoever.
Running pub serve from command line does exactly the same, until you kill it and re-run pub serve, your changes doesn't become visible.
Any idea on how I can have pub serve automatically reload upon code changes?
Update:
I think this could be related: https://code.google.com/p/dart/issues/detail?id=21402
It seems the problem is caused by Safe Write, there's a temp workaround:
WEB-13739 Pub Serve on Mac OS doesn't notice that file contents
changed, so refresh in browser shows old cached contents In DartEditor
you can work like this:
Start debug (this will start pub serve which takes a while).
Edit template in polymer element
Save (Now DartEditor does something to recompile the polymer template, AFAIK it does not do a full restart of pub serve because it
is faster).
Refresh browser, you see the change in the template.
But in Webstorm 9 EAP October 8 version, this workflow is not
possible. I have to kill pub serve and restart in order to see my
change in the polymer component's template. I would like Webstorm to
work the same as DartEdtior so I can have the same save/refresh
development cycle.
Workaround: uncheck 'safe write' mode in Preferences | Appearance &
Behavior | System Settings and vote for the corresponding issue in the
Google issue tracker.
https://youtrack.jetbrains.com/issue/WEB-13739
This workaround is relevant to IntelliJ Ultimate as well.
Vote for bug fix here:
https://code.google.com/p/dart/issues/detail?id=21402
Update
Bug was fixed:
This should be working now. The underlying issue was in the watcher
package, fixed here:
https://codereview.chromium.org/861313006/
Then pulled into the repo for pub and tested here:
https://codereview.chromium.org/801943005/
https://codereview.chromium.org/870703003/
Thanks Bob!

How to get around memory error with karma & phantomjs

We're running tests using karma and phantomjs Last week, our tests mysteriously started crashing phantomJS with an error of -1073741819.
Based on this thread for Chutzpah it appears that code indicates a native memory failure with PhantomJS.
Upon further investigation, we are consistently seeing phantom crash around 750MB of memory.
Is there a way to configure Karma so that it does not run up against this limit? Or a way to tell it to flush phantom?
We only have around 1200 tests so far. We're about 1/4 of the way through our project, so 5000 UI tests doesn't seem out of the question.
Thanks to the StackOverflow phenomenon of posting a question and quickly discovering an answer, we solved this by adding gulp tasks. Before we were just running karma start at the command line. This spun up a single instance of phantomjs that crashed when 750MB was reached.
Now we have a gulp command for each one of our sections of tests, e.g. gulp common-tests and gulp admin-tests and gulp customer-tests
Then a single gulp karma that runs each of those groupings. This allows each gulp command to have its own instance of phantom, and therefore stay underneath that threshold.
We ran into similar issue. Your approach is interesting and certainly side steps the issue. However, be prepared to face it again later.
I've done some investigation and found the cause of memory growth (at least in our case). Turns out when you use:
beforeEach(inject(SomeActualService)){ .... }
the memory taken up by SomeActualService does not get released at the end of the describe block and if you have multiple test files where you inject the same service (or other injectable objects) more memory will be allocated for it again.
I have a couple of ideas on how to avoid this:
1. create mock objects and never use inject to get real objects unless you are in the test that tests that module. This will require writing tons of extra code.
2. Create your own tracker (for tests only) for injectable objects. That way they can be loaded only once and reused between test files.
Forgot to mention: We are using angular 1.3.2, Jasmine 2.0 and hit this problem around 1000 tests.
I was also running into this issue after about 1037 tests on Windows 10 with PhantomJS 1.9.18.
It would appear as ERROR [launcher]: PhantomJS crashed. after the RAM for the process would exceed about 800-850 MB.
There appears to be a temporary fix here:
https://github.com/gskachkov/karma-phantomjs2-launcher
https://www.npmjs.com/package/karma-phantomjs2-launcher
You install it via npm install karma-phantomjs2-launcher --save-dev
But then need to use it in karma.conf.js via
config.set({
browsers: ['PhantomJS2'],
...
});
This seems to run the same set of tests while only using between 250-550 MB RAM and without crashing.
Note that this fix works out of the box on Windows and OS X, but not Linux (PhantomJS2 binaries won't start). This affects pushes to Travis CI.
To work around this issue on Debian/Ubuntu:
sudo apt-get install libicu52 libjpeg8 libfontconfig libwebp5
This is a problem with PhantomJS. According to another source, PhantomJS only runs the garbage collector when the page is closed, and this only happens after your tests run. Other browsers work fine because their garbage collectors work as expected.
After spending a few days on the issue, we concluded that the best solution was to split tests into groups. We had grunt create a profile for each directory dynamically and created a command that runs all those profiles. For all intents and purposes, it works just the same.
We had a similar issue on linux (ubuntu), that turned out to be the amount of memory segments that the process can manage:
$ cat /proc/sys/vm/max_map_count
65530
Then run this:
$ sudo bash -c 'echo 6553000 > /proc/sys/vm/max_map_count'
Note the number was multiplied by 100.
This will change the session settings. If it solves the problem, you can set it up for all future sessions:
$ sudo bash -c 'echo vm.max_map_count = 6553000 > /etc/sysctl.d/60-max_map_count.conf'
Responding to an old question, but hopefully this helps ...
I have a build process which a CI job runs in a command line only linux box. So, it seems that PhantomJS is my only option there. I have experienced this memory issue locally on my mac, but somehow it doesn't happen on the linux box. My solution was to add another test command to my package.json to run karma using Chrome, and run that locally to run my tests. When pushed up, Jenkins would kick off the regular test command, running PhantomJS.
Install this plugin: https://github.com/karma-runner/karma-chrome-launcher
Add this to package.json
"test": "karma start",
"test:chrome": "karma start --browsers Chrome"