Friday, July 21, 2017

MacOs threads limit during GWT compilation

Hello.

I have a very big GWT project which recently has become a bit more bigger. After a new GWT module was added the following error started to occur:


/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/bin/java

-Dapple.awt.UIElement=true

-Xmx2048m

-Dorg.jboss.logging.provider=jdk

-Dorg.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.JavaUtilLog

"-javaagent:/Applications/IntelliJ IDEA.app/Contents/lib/idea_rt.jar=54880:/Applications/IntelliJ IDEA.app/Contents/bin"

-Dfile.encoding=UTF-8

-classpath "VERY:BIG:CLASSPATH"


com.google.gwt.dev.DevMode -superDevMode -style PRETTY -war /Users/username/Library/Caches/IntelliJIdea2017.1/gwt/project.5b9c19f7/Project-gwt.9c4fbf78/run/www -remoteUI 7906:IntelliJIdea com.example.gwt.ProjectEntryPoint com.example.gwt.pages.Pages com.example.gwt.login.LoginPage com.example.gwt.admin.AdminPage


Running CodeServer with parameters: [-noprecompile, -port, 9876, -sourceLevel, 1.8, -bindAddress, 127.0.0.1, -launcherDir, /Users/username/Library/Caches/IntelliJIdea2017.1/gwt/project.5b9c19f7/Project-gwt.9c4fbf78/run/www, -logLevel, INFO, -style, PRETTY, com.example.gwt.ProjectEntryPoint, com.example.gwt.pages.Pages, com.example.gwt.login.LoginPage, com.example.gwt.admin.AdminPage]


Super Dev Mode starting up

  workDir: /var/folders/pd/1gzkcy4d4md1hcrwmjjbzqrc0000gn/T/gwt-codeserver-7810232587123559115.tmp

Jul 21, 2017 4:09:24 PM org.eclipse.jetty.util.log.JavaUtilLog info


INFO: Logging initialized @3481ms

  Loading Java files in com.example.gwt.ProjectEntryPoint.

  Module setup completed in 49903 ms

  Loading Java files in com.example.gwt.pages.Pages.

  Module setup completed in 2964 ms

  Loading Java files in com.example.gwt.login.LoginPage.

  Module setup completed in 2350 ms


java.lang.OutOfMemoryError: unable to create new native thread

       at java.lang.Thread.start0(Native Method)

       at java.lang.Thread.start(Thread.java:717)

       at java.util.concurrent.ThreadPoolExecutor.addWorker(ThreadPoolExecutor.java:950)

       at java.util.concurrent.ThreadPoolExecutor.ensurePrestart(ThreadPoolExecutor.java:1587)

       at java.util.concurrent.ScheduledThreadPoolExecutor.delayedExecute(ScheduledThreadPoolExecutor.java:334)

       at java.util.concurrent.ScheduledThreadPoolExecutor.scheduleAtFixedRate(ScheduledThreadPoolExecutor.java:573)

       at java.util.concurrent.Executors$DelegatedScheduledExecutorService.scheduleAtFixedRate(Executors.java:735)

       at sun.nio.fs.PollingWatchService$PollingWatchKey.enable(PollingWatchService.java:290)

       at sun.nio.fs.PollingWatchService.doPrivilegedRegister(PollingWatchService.java:172)

       at sun.nio.fs.PollingWatchService.access$000(PollingWatchService.java:45)

       at sun.nio.fs.PollingWatchService$2.run(PollingWatchService.java:128)

       at sun.nio.fs.PollingWatchService$2.run(PollingWatchService.java:125)

       at java.security.AccessController.doPrivileged(Native Method)

       at sun.nio.fs.PollingWatchService.register(PollingWatchService.java:124)

       at sun.nio.fs.UnixPath.register(UnixPath.java:897)

       at sun.nio.fs.AbstractPath.register(AbstractPath.java:104)

       at com.google.gwt.dev.resource.impl.ResourceAccumulator.onNewDirectory(ResourceAccumulator.java:163)

       at com.google.gwt.dev.resource.impl.ResourceAccumulator.fullRefresh(ResourceAccumulator.java:91)

       at com.google.gwt.dev.resource.impl.ResourceAccumulator.refreshResources(ResourceAccumulator.java:69)

       at com.google.gwt.dev.resource.impl.ResourceAccumulatorManager.getResources(ResourceAccumulatorManager.java:113)

       at com.google.gwt.dev.resource.impl.DirectoryClassPathEntry.findApplicableResources(DirectoryClassPathEntry.java:49)

       at com.google.gwt.dev.resource.impl.ResourceOracleImpl.scanResources(ResourceOracleImpl.java:263)

       at com.google.gwt.dev.cfg.ModuleDef.getBuildResourceOracle(ModuleDef.java:405)

       at com.google.gwt.dev.CompilerContext$Builder.initializeResourceOracles(CompilerContext.java:101)

       at com.google.gwt.dev.CompilerContext$Builder.build(CompilerContext.java:48)

       at com.google.gwt.dev.codeserver.Recompiler.loadModule(Recompiler.java:447)

       at com.google.gwt.dev.codeserver.Recompiler.initWithoutPrecompile(Recompiler.java:204)

       at com.google.gwt.dev.codeserver.Outbox.maybePrecompile(Outbox.java:89)

       at com.google.gwt.dev.codeserver.Outbox.<init>(Outbox.java:61)

       at com.google.gwt.dev.codeserver.CodeServer.makeOutboxTable(CodeServer.java:192)

       at com.google.gwt.dev.codeserver.CodeServer.start(CodeServer.java:151)

       at com.google.gwt.dev.codeserver.CodeServer.main(CodeServer.java:104)

       at com.google.gwt.dev.codeserver.CodeServer.main(CodeServer.java:55)

       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

       at java.lang.reflect.Method.invoke(Method.java:498)

       at com.google.gwt.dev.shell.SuperDevListener.runCodeServer(SuperDevListener.java:112)

       at com.google.gwt.dev.shell.SuperDevListener.start(SuperDevListener.java:91)

       at com.google.gwt.dev.DevMode.ensureCodeServerListener(DevMode.java:666)

       at com.google.gwt.dev.DevModeBase.doStartup(DevModeBase.java:810)

       at com.google.gwt.dev.DevMode.doStartup(DevMode.java:551)

       at com.google.gwt.dev.DevModeBase.startUp(DevModeBase.java:913)

       at com.google.gwt.dev.DevModeBase.run(DevModeBase.java:706)

       at com.google.gwt.dev.DevMode.main(DevMode.java:432)


During the compilation process I can see (in Activity Monitor) that the amount of threads for DevMode process raises up to 2K and then the error occurs. As far as I can see, the default limit of threads per process on MacOS ("sysctl kern.num_taskthreads") is 2048 which means that I hit it. Changing Xmx limit (obviously) doesn't solve the problem.

I tried to decrease the amount of local workers, but faced the following error:

Unknown argument: -localWorkers

Google Web Toolkit 2.8.1


DevMode [-[no]startServer] [-port port-number | "auto"] [-logdir directory] [-logLevel (ERROR|WARN|INFO|TRACE|DEBUG|SPAM|ALL)] [-gen dir] [-bindAddress host-name-or-address] [-codeServerPort port-number | "auto"] [-[no]superDevMode] [-server servletContainerLauncher[:args]] [-startupUrl url] [-war dir] [-deploy dir] [-extra dir] [-modulePathPrefix ] [-workDir dir] [-XmethodNameDisplayMode (NONE|ONLY_METHOD_NAME|ABBREVIATED|FULL)] [-sourceLevel [auto, 1.8]] [-[no]generateJsInteropExports] [-includeJsInteropExports/excludeJsInteropExports regex] [-[no]incremental] [-style (DETAILED|OBFUSCATED|PRETTY)] [-[no]failOnError] [-setProperty name=value,value...] module[s]


where

 -[no]startServer                                  Starts a servlet container serving the directory specified by the -war flag. (defaults to ON)

 -port                                             Specifies the TCP port for the embedded web server (defaults to 8888)

 -logdir                                           Logs to a file in the given directory, as well as graphically

 -logLevel                                         The level of logging detail: ERROR, WARN, INFO, TRACE, DEBUG, SPAM or ALL (defaults to INFO)

 -gen                                              Debugging: causes normally-transient generated types to be saved in the specified director

 -bindAddress                                      Specifies the bind address for the code server and web server (defaults to 127.0.0.1)

 -codeServerPort                                   Specifies the TCP port for the code server (defaults to 9997 for classic Dev Mode or 9876 for Super Dev Mode)

 -[no]superDevMode                                 Runs Super Dev Mode instead of classic Development Mode. (defaults to ON)

 -server                                           Specify a different embedded web server to run (must implement ServletContainerLauncher)

 -startupUrl                                       Automatically launches the specified URL

 -war                                              The directory into which deployable output files will be written (defaults to 'war')

 -deploy                                           The directory into which deployable but not servable output files will be written (defaults to 'WEB-INF/deploy' under the -war directory/jar, and may be the same as the -extra directory/jar

 -extra                                            The directory into which extra files, not intended for deployment, will be written

 -modulePathPrefix                                 The subdirectory inside the war dir where DevMode will create module directories. (defaults empty for top level)

 -workDir                                          The compiler's working directory for internal use (must be writeable; defaults to a system temp dir)

 -XmethodNameDisplayMode                           EXPERIMENTAL: Specifies method display name mode for chrome devtools: NONE, ONLY_METHOD_NAME, ABBREVIATED or FULL (defaults to NONE)

 -sourceLevel                                      Specifies Java source level (defaults to 1.8)

 -[no]generateJsInteropExports                     Generate exports for JsInterop purposes. If no -includeJsInteropExport/-excludeJsInteropExport provided, generates all exports. (defaults to OFF)

 -includeJsInteropExports/excludeJsInteropExports  Include/exclude members and classes while generating JsInterop exorts. Flag could be set multiple times to expand the pattern. (The flag has only effect if exporting is enabled via -generateJsInteropExports)

 -[no]incremental                                  Compiles faster by reusing data from the previous compile. (defaults to ON)

 -style                                            Script output style: DETAILED, OBFUSCATED or PRETTY (defaults to OBFUSCATED)

 -[no]failOnError                                  Fail compilation if any input file contains an error. (defaults to OFF)

 -setProperty                                      Set the values of a property in the form of propertyName=value1[,value2...].

and

 module[s]                                         Specifies the name(s) of the module(s) to host


Process finished with exit code 255


I can try to find a way to increase the amount of threads per process but that is obviously a wrong solution. So, does anyone have an idea why "-localWorkers" option isn't available or what else can be done to decrease the amount of gwt threads?

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment