Vertx load a huge javascript file - Thread blocked - vert.x

at this time, i created an example github project - https://github.com/marcelalburg/vertx-hugejson-thread-block-example.
My problem is, that vertx blocks my thread during a js file deployment.
The server.js file in src/main/resources is aprox 4mb big - this should simulate my react redux server side rendering file (this one is aprox 1.2 mb pure javascript).
during the deployment, the nashorn engine try to load the file and during the parsing, vertx is blocked.
does anybody has an idea, how i can prevent this blocking ?
Thanks Marcel

Is that really a problem? I do also have similar Thread blocked logs in my project, where Jersey (I'm using https://github.com/englishtown/vertx-jersey) takes pretty long time to start up.
To quote the documentation:
If you do that, then that event loop will not be able to do anything else while it’s blocked. If you block all of the event loops in Vertx instance then your application will grind to a complete halt!
You don't need (and probably want) to process other, including client, requests, so for me it's completely OK to block event loop at this stage.

I'm not sure I understand your question, but it's loading QUITE fast for me:
gorre#doom $ java -jar target/application.jar
May 11, 2016 10:39:47 AM com.hazelcast.instance.DefaultAddressPicker
INFO: [LOCAL] [dev] [3.5.2] Prefer IPv4 stack is true.
May 11, 2016 10:39:47 AM com.hazelcast.instance.DefaultAddressPicker
INFO: [LOCAL] [dev] [3.5.2] Picked Address[192.168.99.1]:5701, using socket ServerSocket[addr=/0:0:0:0:0:0:0:0,localport=5701], bind any local is true
May 11, 2016 10:39:47 AM com.hazelcast.spi.OperationService
INFO: [192.168.99.1]:5701 [dev] [3.5.2] Backpressure is disabled
May 11, 2016 10:39:47 AM com.hazelcast.spi.impl.operationexecutor.classic.ClassicOperationExecutor
INFO: [192.168.99.1]:5701 [dev] [3.5.2] Starting with 4 generic operation threads and 8 partition operation threads.
May 11, 2016 10:39:47 AM com.hazelcast.system
INFO: [192.168.99.1]:5701 [dev] [3.5.2] Hazelcast 3.5.2 (20150826 - ba8dbba) starting at Address[192.168.99.1]:5701
May 11, 2016 10:39:47 AM com.hazelcast.system
INFO: [192.168.99.1]:5701 [dev] [3.5.2] Copyright (c) 2008-2015, Hazelcast, Inc. All Rights Reserved.
May 11, 2016 10:39:47 AM com.hazelcast.instance.Node
INFO: [192.168.99.1]:5701 [dev] [3.5.2] Creating MulticastJoiner
May 11, 2016 10:39:47 AM com.hazelcast.core.LifecycleService
INFO: [192.168.99.1]:5701 [dev] [3.5.2] Address[192.168.99.1]:5701 is STARTING
May 11, 2016 10:39:50 AM com.hazelcast.cluster.impl.MulticastJoiner
INFO: [192.168.99.1]:5701 [dev] [3.5.2]
Members [1] {
Member [192.168.99.1]:5701 this
}
May 11, 2016 10:39:50 AM com.hazelcast.core.LifecycleService
INFO: [192.168.99.1]:5701 [dev] [3.5.2] Address[192.168.99.1]:5701 is STARTED
May 11, 2016 10:39:50 AM com.hazelcast.partition.InternalPartitionService
INFO: [192.168.99.1]:5701 [dev] [3.5.2] Initializing cluster partition table first arrangement...
May 11, 2016 10:39:50 AM example.TestApplication
INFO: Cluster ready, starting verticle deploy
May 11, 2016 10:39:52 AM server.js
INFO: vertxStartAsync
May 11, 2016 10:39:53 AM example.TestApplication
INFO: Done
UPDATE: I think that, in this case (and mostly for everyone else who might be doing the same), you are mainly reading data from the file. If that's the case, you can alternatively start the "server" and launch an asynchronous call to read a file, then have its content available later on. In that fashion you won't be blocking your Event Loop, which is what I think it's happening to you right now.

Related

Why does list classes in local OrientDB console hang?

I am trying to run list classes from the console:
orientdb {db=mydb}> list classes
CLASSES
But it hangs here indefinitely and then when I interrupt it:
Jul 07, 2020 10:02:27 AM com.orientechnologies.common.log.OLogManager log
WARNING: Received signal: SIGINT
Jul 07, 2020 10:02:27 AM com.orientechnologies.common.log.OLogManager log
INFO: Orient Engine is shutting down...
Jul 07, 2020 10:02:27 AM com.orientechnologies.common.log.OLogManager log
INFO: - shutdown storage: wdb2...
It works fine if I ssh to the server and run the console there but if I run the console locally then it doesn't work.
Selecting the classes from the schema metadata works in both cases:
orientdb {db=mydb}>select expand(classes) from metadata:schema
The only thing that I can think of is perhaps I am missing something on the classpath as I am running the orientdb-tools JAR myself.
Any ideas?

Tomcat persistence manager using MongoDB as a Persistence store leads problems

I used Tomcat Persistence manager with MongoDB as a persistence store.I am getting lot of problems related to this.
Tomcat not going to shutdown properly. I need to kill it later.
It showing log like this.
Tomcat Log::: Jun 28, 2016 6:36:23 AM org.apache.catalina.core.StandardServer await
INFO: A valid shutdown command was received via the shutdown port.Stopping the Server instance.
Jun 28, 2016 6:36:23 AM org.apache.coyote.AbstractProtocol pause
INFO: Pausing ProtocolHandler ["http-bio-9082"]
Jun 28, 2016 6:36:23 AM org.apache.coyote.AbstractProtocol pause
INFO: Pausing ProtocolHandler ["ajp-bio-8009"]
Jun 28, 2016 6:36:23 AM org.apache.catalina.core.StandardService stopInternal
INFO: Stopping service Catalina
Jun 28, 2016 6:36:23 AM com.mongodb.diagnostics.logging.JULLogger log
INFO: Closed connection [connectionId{localValue:24, serverValue:619}] to <host ip>:<port> because the underlying connection was closed.
After that no response.Then I manually killed that process.
MongoDB collection creating documents more than I expected(approxiamately 100 times). I took reference from these pages.
Tomcat Persistence manager
Mongo Store
Can Any One help regarding these issues?

INFO: Server startup in 443626 ms for tomcat in eclipse IDE

i have installed eclipse IDE, apache ant 1.8 and tomcat 1.8.2.
When starting the server in eclipse its taking a lot of time and log shows below message in the console.
I am not able to see the configuration page of liferay. How can i fix this?
May 26, 2014 3:37:55 AM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in
production environments was not found on the java.library.path: C:\Program Files\java
\jre8\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Windows\system32;C:
\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:
\Program Files (x86)\Windows Kits\8.0\Windows Performance Toolkit\;C:\Program
Files\java\jdk1.8.0_05\bin;.
May 26, 2014 3:37:56 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-9222"]
May 26, 2014 3:37:56 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
May 26, 2014 3:37:56 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1852 ms
May 26, 2014 3:37:56 AM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
May 26, 2014 3:37:56 AM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.40
May 26, 2014 3:37:56 AM org.apache.catalina.startup.HostConfig deployDescriptor
INFO: Deploying configuration descriptor C:\sarika\liferay-portal-tomcat-6.1.2\liferay-
portal-6.1.2-ce-ga3\tomcat-7.0.40\conf\Catalina\localhost\ROOT.xml
Loading jar:file:/C:/sarika/liferay-portal-tomcat-6.1.2/liferay-portal-6.1.2-ce-ga3
/tomcat-7.0.40/webapps/ROOT/WEB-INF/lib/portal-impl.jar!/system.properties
Loading jar:file:/C:/sarika/liferay-portal-tomcat-6.1.2/liferay-portal-6.1.2-ce-ga3
/tomcat-7.0.40/webapps/ROOT/WEB-INF/lib/portal-impl.jar!/portal.properties
Loading file:/C:/sarika/liferay-portal-tomcat-6.1.2/liferay-portal-6.1.2-ce-ga3
/portal-ide.properties
Loading file:/C:/sarika/liferay-portal-tomcat-6.1.2/liferay-portal-6.1.2-ce-ga3
/tomcat-7.0.40/webapps/ROOT/WEB-INF/classes/portal-developer.properties
May 26, 2014 3:39:21 AM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
03:39:37,644 INFO [localhost-startStop-1][DialectDetector:71] Determine dialect for
HSQL Database Engine 2
03:39:37,651 WARN [localhost-startStop-1][DialectDetector:86] Liferay is configured
to use Hypersonic as its database. Do NOT use Hypersonic in production. Hypersonic
is an embedded database useful for development and demo'ing purposes. The database
settings can be changed in portal-ext.properties.
03:39:39,187 INFO [localhost-startStop-1][DialectDetector:136] Found dialect
org.hibernate.dialect.HSQLDialect
03:42:37,085 WARN [localhost-startStop-1][PDFProcessorImpl:235] Liferay is not
configured to use ImageMagick. For better quality document and image previews,
install ImageMagick and enable it in portal-ext.properties or in the Server
Administration control
panel at: http://<server>/group/control_panel/manage/-/server/external-services
Starting Liferay Portal Community Edition 6.1.2 CE (Paton / Build 6102 / August 2,
2013) 03:44:06,242 INFO [localhost-startStop-1][BaseDB:478] Database supports
case sensitive queries
03:44:12,691 INFO [localhost-startStop-1][ServerDetector:169] Server supports hot
deploy
03:44:12,779 INFO [localhost-startStop-1][PluginPackageUtil:1046] Reading plugin
package for the root context
03:46:07,400 INFO [localhost-startStop-1][AutoDeployDir:144] Auto deploy scanner
started for C:\sarika\liferay-portal-tomcat-6.1.2\liferay-portal-6.1.2-ce-ga3\deploy
May 26, 2014 3:46:59 AM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring FrameworkServlet 'Remoting Servlet'
May 26, 2014 3:47:17 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\sarika\liferay-portal-tomcat-
6.1.2\liferay-portal-6.1.2-ce-ga3\tomcat-7.0.40\webapps\JspDemo
May 26, 2014 3:47:20 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\sarika\liferay-portal-tomcat-
6.1.2\liferay-portal-6.1.2-ce-ga3\tomcat-7.0.40\webapps\marketplace-portlet
May 26, 2014 3:47:49 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\sarika\liferay-portal-tomcat-
6.1.2\liferay-portal-6.1.2-ce-ga3\tomcat-7.0.40\webapps\portal-compat-hook
May 26, 2014 3:48:06 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\sarika\liferay-portal-tomcat-
6.1.2\liferay-portal-6.1.2-ce-ga3\tomcat-7.0.40\webapps\resources-importer-web
May 26, 2014 3:48:14 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\sarika\liferay-portal-tomcat-
6.1.2\liferay-portal-6.1.2-ce-ga3\tomcat-7.0.40\webapps\welcome-theme
May 26, 2014 3:48:32 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-9222"]
May 26, 2014 3:48:34 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
May 26, 2014 3:48:34 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 637937 ms
Log shows that its still using hypersonic database. It is in memory database, so performance depends on CPU utilization on your server and memory allocation. Better to change to MySQL database.
Change to MySQL database
Your updated log still has HSQL database connection. You mentioned that you specified MySQL properties. I guess they are not taking into effect.
Please make sure that your configuration in portal-ext.properties(Please check name of your file, in comment you mentioned file name as portlet-ext.properties, that is wrong) match as below.
Make sure that you keep portal-ext.properties in C:\sarika\liferay-portal-tomcat-6.1.2\liferay-portal-6.1.2-ce-ga3
#
# MySQL
#
jdbc.default.driverClassName=com.mysql.jdbc.Driver
jdbc.default.url=jdbc:mysql://localhost/<your database name here>?useUnicode=true&characterEncoding=UTF-8&useFastDateParsing=false
jdbc.default.username=<your database user name here>
jdbc.default.password=<your database password here>
Increase RAM
Increasing allocated RAM for liferay tomcat will improve. Below given configuration is just an example. As per availability of RAM on your machine, you may allocate more. But having same value for Xms & Xmx ensures that all memory allocated for tomcat initially saving time on increasing memory gradually.
-Xms2048m -Xmx2048m -XX:MaxPermSize=512m
If you have liferay tomcat in Windows, Add above configuration to setenv.bat in /bin. In case of Linux, configuration should be in setenv.sh for JAVA_OPTS variable.

Can't get my webapp accessible using eclipse, apache2 and tomcat7 (Ubuntu)

I'm quite a rookie about servlets, but I should deploy an Eclipse web project running on a Tomcat server (only localhost).
The whole process worked fine on Windows but recently I had to move to Ubuntu 12.04 and I have this problem when I want to access the app:
If I start apache2 and tomcat7 first, the output of
sudo netstat -lpn |grep :80
looks like this:
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 12231/apache2
tcp6 0 0 127.0.0.1:8005 :::* LISTEN 12848/java
tcp6 0 0 :::8080 :::* LISTEN 12848/java
then I try to start the server in eclipse and face this error:
Several ports (8005, 8080) required by cdrserver are already in use. The server may already >be running in another process, or a system process may be using the port. To start this >server you will need to stop the other process or change the port number(s).
Alright, let's kill these processes (although it seems that Tomcat uses them since when i stop tomcat, the 2 tcp6 processes disappear).
Now I'm able to start the Eclipse server, without a single warning:
Nov 27, 2013 10:59:24 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Nov 27, 2013 10:59:24 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 869 ms
Nov 27, 2013 10:59:24 AM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Nov 27, 2013 10:59:24 AM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.26
Nov 27, 2013 10:59:24 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory /home/aron/workspace/Text_manipulator
Nov 27, 2013 10:59:26 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory /home/aron/workspace/.metadata
Nov 27, 2013 10:59:26 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory /home/aron/workspace/Servers
Nov 27, 2013 10:59:26 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
Nov 27, 2013 10:59:26 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 2101 ms
Now, if I type the usual (like on Windows) URL to the browser: localhost/cdr I get this:
Not Found
The requested URL /cdr was not found on this server.
Apache/2.2.22 (Ubuntu) Server at localhost Port 80
Same happens with localhost/manager (I got this tip lately).
Moreover, using localhost:8080/cdr results in a totally blank page.
Here are my Eclipse server settings: http://i.imgur.com/lV6FwTm.png
I also checked the web.xml file in the project, it has the following servlet classes and related mappings:
Faces Servlet
Trinidad Resource Servlet
Resources Servlet
Spring MVC Dispatcher Servlet
Am I missing something obvious?
The requested URL /cdr was not found on this server.
Apache/2.2.22 (Ubuntu) Server at localhost Port 80
Firstly your URL should be something like localhost:8080 , Not localhost since this defaults to localhost:80 and you have apache2 running on your system thats why you get the 404 message of the apache server.
Secondly , I am concerned about the resources being deployed as shown by your logs
Nov 27, 2013 10:59:24 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory /home/aron/workspace/Text_manipulator
Nov 27, 2013 10:59:26 AM org.apache.catalina.startup.HostConfig deployDirectory
**INFO: Deploying web application directory /home/aron/workspace/.metadata** --> ?
Nov 27, 2013 10:59:26 AM org.apache.catalina.startup.HostConfig deployDirectory
**INFO: Deploying web application directory /home/aron/workspace/Servers** --> ?
Nov 27, 2013 10:59:26 AM org.apache.coyote.AbstractProtocol start
What is .metadata ? Isn't this one of the hidden folders created by eclipse to manage workspace. This shouldn't be deployed.
Also what is Servers ? This looks like the server project from eclipse.
I don't see any resource namely cdr being deployed from the logs. So first you need to verify that this particular resource is deployed at all. Secondly, I would advise you to do some reading on how Tomcat works here.

Deploying grails 2.0.3 application to cloudfoundry without cloud foundry grails-plugin?

I'm able to deploy my grails 2.0.3 app with the cloud foundry grails plugin and cf-push to the cloud and everything works fine.
Now i want to use the sts/eclipse cloud foundry extension to deploy with eclipse (not with grails command cf-push!) and see the server instances in server view and so on.
I create a new cloudfoundry instance with the eclipse plugin and it deploys but aborts with error message:
May 14, 2012 10:39:21 AM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-19036
May 14, 2012 10:39:21 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 377 ms
May 14, 2012 10:39:21 AM org.apache.catalina.realm.JAASRealm setContainer
INFO: Set JAAS app name Catalina
May 14, 2012 10:39:21 AM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
May 14, 2012 10:39:21 AM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.35
May 14, 2012 10:39:21 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory ROOT
Configuring Spring Security Core ...
... finished configuring Spring Security Core
May 14, 2012 10:39:32 AM org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart
May 14, 2012 10:39:32 AM org.apache.catalina.core.StandardContext start
SEVERE: Context [] startup failed due to previous errors
May 14, 2012 10:39:32 AM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [] appears to have started a thread named [net.sf.ehcache.CacheManager#1edb587] but has failed to stop it. This is very likely to create a memory leak.
May 14, 2012 10:39:32 AM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [] appears to have started a thread named [projectBee.Requestmap.data] but has failed to stop it. This is very likely to create a memory leak.
May 14, 2012 10:39:32 AM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [] appears to have started a thread named [projectBee.Role.data] but has failed to stop it. This is very likely to create a memory leak.
May 14, 2012 10:39:32 AM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [] appears to have started a thread named [org.hibernate.cache.UpdateTimestampsCache.data] but has failed to stop it. This is very likely to create a memory leak.
May 14, 2012 10:39:32 AM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [] appears to have started a thread named [org.hibernate.cache.StandardQueryCache.data] but has failed to stop it. This is very likely to create a memory leak.
Stopping Tomcat because the context stopped.
Is here somebody who knows a solution for this problem? Thank you!
You need to look at the real log files which will have the stacktrace and detailed error messages. Use the vmc commandline client or STS. There is a /logs folder which probably doesn't have what you want, but also a /tomcat/logs which probably does. Also check out stacktrace.log.