Code is not being executed on one core even though it is online - pm2

Right after the startup of the app, everything seems fine, all four cores are online running in the cluster mode. Two cores have the same name, remaining two differ. Here is the ecosystem.json file:
{ 'apps': [
{
'name': 'CHS',
'script': './main.js',
'out_file': '../logs/appname.log',
'error_file': '../logs/appname.log',
'log_date_format' : 'YYYY-MM-DD HH:mm:ss Z',
'rotateModule': true,
'compress': true,
'dateFormat': 'YYYY-MM-DD',
'max_size': '10M',
'retain': 300,
'log_date_format' : 'YYYY-MM-DD HH:mm:ss Z',
'merge_logs': true,
'env': {
'NODE_ENV': 'production',
'METEOR_SETTINGS': '{ ... }'
},
'env_production': {
'NODE_ENV': 'production'
},
'instances': '1',
'exec_mode': 'cluster'
},
{
'name': 'ORC',
'script': './main.js',
'out_file': '../logs/appname.log',
'error_file': '../logs/appname.log',
'log_date_format' : 'YYYY-MM-DD HH:mm:ss Z',
'rotateModule': true,
'compress': true,
'dateFormat': 'YYYY-MM-DD',
'max_size': '10M',
'retain': 300,
'merge_logs': true,
'env': {
'NODE_ENV': 'production',
'METEOR_SETTINGS': '{ ... }'
},
'env_production': {
'NODE_ENV': 'production'
},
'instances': '1',
'exec_mode': 'cluster'
},
{
'name': 'WCR',
'script': './main.js',
'out_file': '../logs/appname.log',
'error_file': '../logs/appname.log',
'log_date_format' : 'YYYY-MM-DD HH:mm:ss Z',
'rotateModule': true,
'compress': true,
'dateFormat': 'YYYY-MM-DD',
'max_size': '10M',
'retain': 300,
'merge_logs': true,
'env': {
'NODE_ENV': 'production',
'METEOR_SETTINGS': '{ ... }'
},
'instances': '2',
'exec_mode': 'cluster'
}
]
}
Few seconds after the startup, CHS core does not execute any code for some reason (without any errors), while other three works fine. I have tried to reorder cores in ecosystem.json, add "pmx": false (per some online suggestion, to avoid some parts in pm2 itself), rename cores, and some other things but issue was the same. I was trying to make sure there is nothing in the app code that makes this issue happens, searched errors in the logs, and this is only I have (in pm2 logs):
2020-04-17T14:16:49: PM2 error: (node:3720) [DEP0007] DeprecationWarning: worker.suicide is depricated. Please use worker.exitedAfterDisconnect.
2020-04-17T14:17:01: PM2 error: Error: write ENOTSUP
at ChildProcess.target._send (internal/child_process.js:692:20)
at ChildProcess.target.send (internal/child_process.js:576:19)
at senderHelper (internal/cluster/utils.js:25:15)
at send (internal/cluster/master.js:357:10)
at handle.add (internal/cluster/master.js:329:5)
at SharedHandle.add (internal/cluster/shared_handle.js:29:3)
at queryServer (internal/cluster/master.js:318:10)
at Worker.onmessage (internal/cluster/master.js:250:5)
at ChildProcess.onInternalMessage (internal/cluster/utils.js:42:8)
at emitTwo (events.js:131:20)
2020-04-17T14:17:01 PM2 log: App name:CHS id:0 disconnected
Also, at the end this happens only on the one windows VM instance (on the second one no issues at all). These instances are identical based on the configurations. PM2 version was 4.2.3 but then I have tried with 3.5.1 and I got the same issue. Does anybody have any idea how to troubleshoot this issue?
Lately it turned out that issue is related with UDP, and probably some unsupported features in node for windows, like this:
https://nodejs.org/api/cluster.html#cluster_event_listening

The root cause was that UDP does not work in a cluster mode on PM2. Actually we were using SNMP which relies on UDP under the hood, and it was not clear we have such an issue considering the logs. Spinning up a new core in a fork mode, running SNMP resolves the issue.

Related

Sublime text: plugin_host is "unable to open channels"

According to info here, plugin_host is an external process that is used to execute plugin code. Unfortunately I'm getting an error (see title) and I probably need to configure this process but how? Thanks
Please note I'm using 32-bit version (https://www.sublimetext.com/3) on Debian 11.
System packages (zip files) are installed in /usr/local/share/sublime-text/Packages
I created symlink in /usr/local/bin linked to the previous folder
Python is installed in $HOME/.config/sublime-text-3/Lib/python3.3
both sublime.py and sublime_plugin.py files are located in $HOME/.config/sublime-text-3/Lib/ folder
Console output:
UI scale: 1.002 (gtk text scale)
startup, version: 3211 linux x32 channel: stable
executable: /usr/local/bin/sublime
working dir: /
packages path: /home/fox/.config/sublime-text-3/Packages
state path: /home/fox/.config/sublime-text-3/Local
zip path: /usr/local/bin/Packages
zip path: /home/fox/.config/sublime-text-3/Installed Packages
ignored_packages: ["Markdown", "Vintage"]
pre session restore time: 0.320594
startup time: 1.57776
first paint time: 1.8247
error: plugin_host has exited unexpectedly, plugin functionality won't be available until Sublime Text has been restarted
Preferences.sublime-settings:
{
"update_check": false,
"color_scheme": "Packages/dark.scheme",
"tab_size": 4,
"translate_tabs_to_spaces": true,
"trim_automatic_white_space": true,
"trim_trailing_white_space_on_save": true,
"ensure_newline_at_eof_on_save": true,
"detect_indentation" : false,
"copy_with_empty_selection": false,
"find_selected_text": true,
"detect_slow_plugins": false,
"auto_complete_delay": 500,
"font_face" : "Source Code Pro",
"font_options":
[
"directwrite"
],
"font_size": 14,
"highlight_line": true,
"ignored_packages": ["Markdown", "Vintage"]
}
❯ /usr/local/bin/plugin_host
Unexpected number of arguments, expected 2
❯ /usr/local/bin/plugin_host --help
unable to open channels

Current RDBS version is not supported for Magento 2.4 Installation

I am installing Magento 2.4 on Vagrant through command line
here is the error I got
Current version of RDBMS is not supported. Used Version: 10.5.8-MariaDB-1:10.5.8+maria~bionic. Supported versions: MySQL-8, MySQL-5.7, MariaDB-(10.2-10.4)
and here is the configurations at my Homestead.yaml
ip: "192.168.10.10"
memory: 2048
cpus: 2
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: ~/code
to: /home/vagrant/code
sites:
- map: realityla.io
to: /home/vagrant/code/realityla
- map: lhm.bb
to: /home/vagrant/code/lhm
- map: magento.ee
to: /home/vagrant/code/magento
databases:
- homestead
features:
- mysql: true
- mariadb: true
- postgresql: false
- ohmyzsh: false
- webdriver: false
# ports:
# - send: 50000
# to: 5000
# - send: 7777
# to: 777
# protocol: udp
How can I change the Mysql or MariaDB version for only my Magento Website
Current version of RDBMS is not supported. Used Version: 10.6.4-MariaDB. Supported versions: MySQL-8, MySQL-5.7, MariaDB-(10.2-10.4)
PHP Version 7.4.27
nginx/1.21.5
Server version: 10.6.4-MariaDB - Homebrew
macOS Catalina Version 10.15.7 (19H1615)
Magento Open Source 2.4.3-p1.zip
Solution
nano vendor/magento/framework/Test/Unit/DB/Adapter/SqlVersionProviderTest.php
'MariaDB-10.6' => [
['version' => '10.6.4-MariaDB'],
'10.6.'
],
add above line in in public function executeDataProvider(): Final function will be like this
/**
* #return array
*/
public function executeDataProvider(): array
{
return [
'MariaDB-10.4' => [
['version' => '10.4.12-MariaDB-1:10.4.12+maria~bionic'],
'10.4.'
],
'MariaDB-10.2' => [
['version' => '10.2.31-MariaDB-1:10.2.31+maria~bionic'],
'10.2.'
],
'MariaDB-10.6' => [
['version' => '10.6.4-MariaDB'],
'10.6.'
],
'MySQL-5.7' => [
['version' => '5.7.29'],
SqlVersionProvider::MYSQL_5_7_VERSION,
],
'MySQL-8' => [
['version' => '8.0.19'],
SqlVersionProvider::MYSQL_8_0_VERSION,
],
'Percona' => [
['version' => '5.7.29-32'],
SqlVersionProvider::MYSQL_5_7_VERSION,
],
];
}
nano app/etc/di.xml
Line no 1856 line will be something like this
<item name="MariaDB-(10.2-10.4)" xsi:type="string">^10\.[2-4]\.</item>
Change it like bellow
<item name="MariaDB-(10.2-10.6)" xsi:type="string">^10\.[2-6]\.</item>
And here is how I found the solution, thanks,
You Can modify the file: vendor/magento/framework/Test/Unit/DB/Adapter/SqlVersionProviderTest.php (Approximately Line 109 and add the MariaDB 10.5 Version to the Array:
'MariaDB-10.5' => [
['version' => '10.5.8-MariaDB-1:10.5.8+maria~bionic'],
'10.5.'
],
and update the file: app/etc/di.xml (approximately Line 1818):
^10.[2-5].
from:
^10.[2-4].
Now I will note, it is NOT advisable to mode core files, however if you want it to run on MariaDB 10.5, that's how you can tackle it.
As a temporary fix you can apply a pull request(s) from this issue #31109: https://github.com/magento/magento2/issues/31109
OR
Wait till issue #31109 would be resolved and use MariaDB-10.4 for now

cant get junit running with Karma

I have installed the npm package karma-junit-reporter at version 2.0.1.
my karma.conf.js file is :
// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '#angular-devkit/build-angular'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-junit-reporter'),
require('karma-coverage-istanbul-reporter'),
require('#angular-devkit/build-angular/plugins/karma')
],
client: {
clearContext: false, // leave Jasmine Spec Runner output visible in browser
captureConsole: true
},
coverageIstanbulReporter: {
dir: require('path').join(__dirname, './coverage/ClientApp'),
reports: ['html', 'lcovonly', 'text-summary'],
fixWebpackSourcePaths: true
},
reporters: ['progress', 'kjhtml', 'junit'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false,
restartOnFileChange: true,
// the default configuration
junitReporter: {
outputDir: 'test', // results will be saved as $outputDir/$browserName.xml
outputFile: 'junit.xml', // if included, results will be saved as $outputDir/$browserName/$outputFile
//suite: '', // suite will become the package name attribute in xml testsuite element
//useBrowserName: false, // add browser name to report and classes names
//nameFormatter: undefined, // function (browser, result) to customize the name attribute in xml testcase element
//classNameFormatter: undefined, // function (browser, result) to customize the classname attribute in xml testcase element
//properties: {}, // key value pair of properties to add to the <properties> section of the report
//xmlVersion: null // use '1' if reporting to be per SonarQube 6.2 XML format
}
});
};
When I run:
ng test --reporters junit
I receive the following error:
can not load reporter "junit", it is not registered! Perhaps you are missing some plugin?
[karma]: No captured browser, open http://localhost:9876/
Ok. I found the answer by chance. Really weird, but this worked. I needed to explicitly mention the config file :
ng test --karma-config=karma.conf.js --reporters junit
it now works even though I was running the ng test command from the same directory as my karma.conf.js file

Gulp Jscs - TypeError: Cannot convert undefined or null to object

I wanted to use gulp-jscs in my project, so I've installed it according the documentation:
npm install --save-dev gulp-jscs
But when I try to run the gulp file, I'm getting this error:
TypeError: Cannot convert undefined or null to object
at Function.keys (native)
at copyConfiguration (C:\Users\[User]\Desktop\[Project]\
node_modules\jscs\lib\config\configuration.js:920:12)
Also, there are other errors related to this:
at NodeConfiguration.Configuration.
_processConfig([location-path]\node_modules\jscs\lib\config\configuration.js:459:5)
at NodeConfiguration.Configuration.load
([location-path]\node_modules\jscs\lib\config\configuration.js:211:10)
at null.StringChecker.configure
([location-path]\node_modules\jscs\lib\string-checker.js:62:29)
at null.Checker.configure ([location-path]\node_modules\jscs\lib\checker.js:27:39)
at Object.module.exports ([location-path]\node_modules\gulp-jscs\index.js:35:10)
at Gulp.<anonymous> ([location-path]\Gulpfile.js:60:17)
at module.exports ([location-path]\node_modules\orchestrator\lib\runTask.js:34:7)
at Gulp.Orchestrator._runTask ([location-path]\node_modules\orchestrator\index.js:273:3)
Process terminated with code 1.
You need to have a .jscsrc file in the root of you project present. In there you can provide options for JSCS as well as the code style rules that should be followed.
Below is the .jscsrc that's used by node-jscs project itself. You can use this to base your own configuration on.
{
"preset": "google",
"fileExtensions": [".js", "jscs"],
"requireSemicolons": true,
"requireParenthesesAroundIIFE": true,
"maximumLineLength": 120,
"validateLineBreaks": "LF",
"validateIndentation": 4,
"disallowTrailingComma": true,
"disallowUnusedParams": true,
"disallowSpacesInsideObjectBrackets": null,
"disallowImplicitTypeConversion": ["string"],
"safeContextKeyword": "_this",
"jsDoc": {
"checkAnnotations": "closurecompiler",
"checkParamNames": true,
"requireParamTypes": true,
"checkRedundantParams": true,
"checkReturnTypes": true,
"checkRedundantReturns": true,
"requireReturnTypes": true,
"checkTypes": "capitalizedNativeCase",
"checkRedundantAccess": true,
"requireNewlineAfterDescription": true
},
"excludeFiles": [
"test/data/**",
"patterns/*"
]
}
Note that jscs won't actually check for anything unless you have a "preset" in your .jscsrc or have explicitly specified the rules that should be followed.

Sublime2 Parse Error

I'm getting an error in Sublime2 SFTP.
Error parsing sftp-config.json file:
No JSON object could be decoded
I'm not sure what is going. Help is appreciated. I've tried uninstalling and reinstalling the SFTP plugin but that didn't fix it.
Here is my code:
{
// The tab key will cycle through the settings when first created
// Visit http://wbond.net/sublime_packages/sftp/settings for help
// sftp, ftp or ftps
"type": "sftp",
"save_before_upload": true,
"upload_on_save": false,
"sync_down_on_open": false,
"sync_skip_deletes": false,
"sync_same_age": true,
"confirm_downloads": false,
"confirm_sync": true,
"confirm_overwrite_newer": false,
"host": "54.173.65.194",
"user": "brent",
//"password": "password",
//"port": "22",
"remote_path": "/example",
"ignore_regexes": [
"\\.sublime-(project|workspace)", "sftp-config(-alt\\d?)?\\.json",
"sftp-settings\\.json", "/venv/", "\\.svn/", "\\.hg/", "\\.git/",
"\\.bzr", "_darcs", "CVS", "\\.DS_Store", "Thumbs\\.db", "desktop\\.ini"
],
//"file_permissions": "664",
//"dir_permissions": "775",
//"extra_list_connections": 0,
"connect_timeout": 30,
//"keepalive": 120,
//"ftp_passive_mode": true,
//"ftp_obey_passive_host": false,
//"ssh_key_file": "~/.ssh/id_rsa",
//"sftp_flags": ["-F", "/path/to/ssh_config"],
//"preserve_modification_times": false,
//"remote_time_offset_in_hours": 0,
//"remote_encoding": "utf-8",
//"remote_locale": "C",
//"allow_config_upload": false,
}
Go to
~/.config/sublime-text-3/Packages/User/sftp_servers
and delete the file that is causing the error
this sftp_server folder contains all your existing server connection config so you can decide which one is causing the problem by reading the error properly.
I think it might be the','(comma) after the connect_timeout. Javscript/json doesn't allow trailing commas on the last item in a list, unlike Python.
I resolved it by uninstalling Sublime 2, removing all preferences, and reinstalling. It works now.
On my MacOS it was non-json file app.py inside (could be another file)
/Users/<your_username>/Library/Application Support/Sublime Text 3/Packages/User/sftp_servers
When I deleted it error disappeared