Forums › Forums › OroCRM › OroCRM – Installation/Technical Issues or Problems › "Synchronizer error", Clank – best practices?
This topic contains 9 replies, has 2 voices, and was last updated by Aaron 9 years, 9 months ago.
Starting from March 1, 2020 the forum has been switched to the read-only mode. Please head to StackOverflow for support.
- CreatorTopic
- June 26, 2014 at 10:38 am #26105
I installed Oro CRM on a digital ocean droplet, and am running it in production mode. For the most part the process was nice and smooth, but I have come across two stumbling blocks which are not addressed in the documentation, and I’m not sure how to resolve them.
There is a “Synchronizer can’t connect to server.” error displayed when anyone logs in. I don’t see any corresponding errors in the apache2 or /app/logs/prod.log files, and I’m not sure what this error means.
The second (possibly related) is that the suggested command to run the Clank server:
1php /var/www/oro-crm/app/console clank:server --env prodSeems inadequate; the process stays attached to the terminal, has debug-ish output, and no process monitoring. To run it in production I have simply “nohup’d” it, and redirected input from /dev/null – but perhaps I am missing something? Is there a suggested php process monitor or other app/console command that is more production appropriate?
Is there an upstart profile, or popular PHP process monitor I could adapt for it? I’m more used to the Ruby ecosystem where this kind of thing would be done with bluepill or god.
- CreatorTopic
- AuthorReplies
- July 1, 2014 at 6:33 am #26106
Hello, Aaron.
For now Clank server should be started manually (as you said). I’m using
app/console clank:server > /dev/null 2>&1 &
to silence all output. We need to improve this behaviour and provide easier way to work with it.In general, if you want to daemonize clank server process, you should work with this command as with regular shell command and use any external tool or shell script to run it as a daemon (f.e. http://software.clapper.org/daemonize/).
July 1, 2014 at 10:35 am #26107Thanks, Yevhen, although that still leaves me wondering about the “Synchronizer can’t connect to server.” error when any user logs in.
In case other people stumble across this discussion before changes are rolled into the console command, here is the solution I’m using on Ubuntu/Linux:
Create a shell file to launch the console command with nohup, and use absolute paths. Write the nohup output to get a pidfile.
Then you can use monit (example monit config) to watch the pidfile and get basic process management.
This should work on any *NIX system which monit works on.
July 2, 2014 at 1:31 am #26108“Synchronizer can’t connect to server.” error might appear if server port (default is 8080) is closed or filtered by firewall. Please, ensure that port is really opened f.e. using nmap:
12345678910user@host:~$ nmap -sT -p 8080 127.0.0.1Starting Nmap 5.21 ( http://nmap.org ) at 2014-07-02 12:31 GETNmap scan report for localhost (127.0.0.1)Host is up (0.000038s latency).PORT STATE SERVICE8080/tcp open http-proxyNmap done: 1 IP address (1 host up) scanned in 0.04 secondsJuly 2, 2014 at 10:29 am #26109hmm, no, nmap reports the port is open:
123456789root@crm:~# nmap -sT -p 8080 127.0.0.1Starting Nmap 6.40 ( http://nmap.org ) at 2014-07-02 13:27 EDTNmap scan report for localhost (127.0.0.1)Host is up (0.00036s latency).PORT STATE SERVICE8080/tcp open http-proxyNmap done: 1 IP address (1 host up) scanned in 0.04 secondsAlso clank appears to be running fine:
123root@crm:~# ps -auxwww | grep clankroot 5289 0.0 2.9 348512 29564 ? S Jun26 0:06 /usr/bin/php /var/www/oro-crm/app/console clank:server --env prodroot 31806 0.0 0.0 11748 924 pts/0 S+ 13:28 0:00 grep --color=auto clankAnd nothing in prod.log or syslog relating to clank.
July 3, 2014 at 1:34 am #26110Ok, let’s check everything from the very beginning.
Clank server parameters at app/config/parameters.yml:
12websocket_host: 127.0.0.1websocket_port: 8080Please, ensure that client part of the application (browser) aware about websocket_host (i.e. this host must be resolved by client to server’s IP) and port is open for client.
Init connection headers (can be found using firebug):
1234567891011121314151617181920212223Request HeadersGET / HTTP/1.1Host: 127.0.0.1:8080User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:28.0) Gecko/20100101 Firefox/28.0Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8Accept-Language: en-US,en;q=0.5Accept-Encoding: gzip, deflateSec-WebSocket-Version: 13Origin: http://crm.devSec-WebSocket-Protocol: wampSec-WebSocket-Key: S1GdjGXRYkx1VrXSEcE59Q==Connection: keep-alive, UpgradePragma: no-cacheCache-Control: no-cacheUpgrade: websocketResponse HeadersHTTP/1.1 101 Switching ProtocolsUpgrade: websocketConnection: Upgradesec-websocket-accept: SCYXMwMuvCzf2j5q3ZqGNT4xPF8=Sec-WebSocket-Protocol: wampX-Powered-By: Ratchet/0.2.7Also you can trace request and response with any HTTP sniffer (f.e. Wireshark).
Clank server output:
12345678Starting ClankLaunching Ratchet WS Server on: 127.0.0.1:80801282 connected1282 disconnected1344 connected1344 disconnected...If something not works – please, put here appropriate logs.
July 3, 2014 at 12:37 pm #26111Thanks for the details.
The problem seems to be that on the browser a request to load a bundle is failing:
12345Unable to load external script.http://crm.baymaterials.com/Line 3702In particular it is trying to load
/bundle/orocrmrequest/js/embed.form.js
Interestingly my install has no “orocrmrequest” directory in the bundles, so that explains the failure. . .I don’t know why my install doesn’t have it, however.
Since I don’t know what is in that file, it may or may not cascade into the later error:
123456789101112131415161718192021ab._construct = function (url, protocols) {if ("WebSocket" in window) {// Chrome, MSIE, newer Firefoxif (protocols) {return new WebSocket(url, protocols);} else {return new WebSocket(url);}} else if ("MozWebSocket" in window) {// older versions of Firefox prefix the WebSocket objectif (protocols) {return new MozWebSocket(url, protocols);} else {return new MozWebSocket(url);}} else {return null;}};According to firebug the ‘url’ variable isn’t defined when that gets called, which leads the client to attempt to open a websocket to a default ofI had the breakpoint set wrong. ‘url’ is not undefined, it is being set to ‘127.0.0.1’ somewhere else in the code. I see a ‘127.0.0.1’ hardcoded on line 505 of the page:
123456789sync(new Wamp({secure: false,host: '127.0.0.1',port: 8080,maxRetries: 3,retryDelay: 30000}));But I don’t know if that value is getting threaded through to the websocket request. I’m not really set up to debug minified js here.
Regardless, it seems like the websocket request should open <the server>:8080 instead of 127.0.0.1:8080 Although the former may be passing tests if you are testing with the server on the local machine. . .
So, what is up with that missing bundle file – should I attempt a new install on another machine and then copy the bundle over?
July 3, 2014 at 2:37 pm #26112Sooo I went out of the frying pan, into the frier.
I decided to migrate to git tag 1.2.0-rc1 to see if the bundle issue was straightened out there.
I pulled, checked out the relevant tag, updated composer deps, and then ran the console update. I got a giant fireball of fail back. I’m going to revert the VM to yesterday’s backup. . .
123456789101112131415161718192021222324252627282930php app/console oro:platform:update --env=prodPHP Warning: Cannot redeclare class in /var/www/oro-crm/vendor/oro/platform/src/Oro/Bundle/EntityExtendBundle/Tools/ExtendClassLoadingUtils.php on line 77ATTENTION: Database backup is highly recommended before executing this command.Please make sure that application cache is up-to-date before run this command.Use cache:clear if needed.To force execution run command with --force option:oro:platform:update --forceroot@crm:/var/www/oro-crm# php app/console oro:platform:update --force --env=prodPHP Warning: Cannot redeclare class in /var/www/oro-crm/vendor/oro/platform/src/Oro/Bundle/EntityExtendBundle/Tools/ExtendClassLoadingUtils.php on line 77PHP Warning: Cannot redeclare class in /var/www/oro-crm/vendor/oro/platform/src/Oro/Bundle/EntityExtendBundle/Tools/ExtendClassLoadingUtils.php on line 77Process migrations...> Oro\Bundle\EntityExtendBundle\Migration\RefreshExtendCacheMigration[Doctrine\Common\Persistence\Mapping\MappingException]Class 'OroEntityProxy\OroEmailBundle\EmailAddressProxy' does not existoro:entity-extend:update-config[RuntimeException]The command terminated with an exit code: 1.oro:migration:load [--force] [--dry-run] [--show-queries] [--bundles[="..."]] [--exclude[="..."]][RuntimeException]The command terminated with an exit code: 1.oro:platform:update [--force] [--timeout[="..."]]July 4, 2014 at 11:06 am #26113Hm… In template host has valid value:
1234567sync(new Wamp({secure: {{ app.request.headers.get('X-Forwarded-Proto') == 'https' ? 'true' : 'false' }},host: '{{ ws.host == '*' ? app.request.headers.get('host') : ws.host }}',port: {{ ws.port }},maxRetries: 3,retryDelay: 30000}));Just checked on the latest master – it uses host from parameters.yml. If you changed web socket parameters – please, update your cache (app/console cache:clear –env prod).
As for update – please, remove app/cache/* and then run oro:platform:update.
July 8, 2014 at 12:45 pm #26114I think it is just a matter of documentation/defaults in the config file, then.
config/parameters.yml should only have websocket_host = 127.0.0.1 if your server and client are on the same machine – otherwise that setting should be updated to reflect the server ip or dns, right? a default of #{env hostname} (or similar) might be more sensible, or explaining that value in the install documentation.
After setting the line to websocket_host = the-host-dns-name and resetting the cache the error seems to be gone – many thanks!
As for upgrading, I reset the VM to the previous image and tried again:
123456789101112131415161718root@crm:/var/www/oro-crm# git pullAlready up-to-date.root@crm:/var/www/oro-crm# git checkout HEADYour branch is up-to-date with 'origin/master'.root@crm:/var/www/oro-crm# php composer.phar install --prefer-dist --no-devLoading composer repositories with package informationInstalling dependencies from lock fileNothing to install or updateGenerating autoload filesUpdating the "app/config/parameters.yml" fileroot@crm:/var/www/oro-crm# rm -rf app/cache/* web/js/* web/css/*root@crm:/var/www/oro-crm# php app/console oro:platform:update --env=prodATTENTION: Database backup is highly recommended before executing this command.Please make sure that application cache is up-to-date before run this command.Use cache:clear if needed.To force execution run command with --force option:oro:platform:update --forcerunning php app/console oro:platform:update –force succeeded this time, perhaps a test user had hit the site between my clearing the cache and attempting the update last time, since I was lazy and hadn’t stopped the server first.
Thanks for all the help, and hopefully this thread is useful to people who run into the same error!
- AuthorReplies
The forum ‘OroCRM – Installation/Technical Issues or Problems’ is closed to new topics and replies.