Cannot log in to Studio when Nexus 3 is in a hang state

Problem Description

Talend Administration Center uses Nexus 3, and you cannot log in to Studio when Nexus is in a hang state. The following window is displayed until you restart Nexus.

Task_popup1.jpg

 

Root Cause

When you start Studio, Nexus auto synchronizes with .m2. If Nexus is in a hang state, the synchronization process does not stop.

 

In this case, a debug trace of nexus.log shows the following error:

2020-02-18 00:32:06,668-0500 DEBUG [qtp1207847155-2976] admin org.sonatype.nexus.orient.DatabasePoolWithOverflowImpl - Unable to acquire connection from main pool, trying overflow
java.lang.IllegalStateException: You have reached maximum pool size for given partition
at com.orientechnologies.orient.core.db.OPartitionedDatabasePool.acquire(OPartitionedDatabasePool.java:244)
at org.sonatype.nexus.orient.DatabasePoolWithOverflowImpl.acquire(DatabasePoolWithOverflowImpl.java:64)
at org.sonatype.nexus.orient.DatabaseInstanceImpl.acquire(DatabaseInstanceImpl.java:70)
at org.sonatype.nexus.repository.storage.StorageFacetImpl.lambda$0(StorageFacetImpl.java:156)
at com.google.common.base.Supplier$get.call(Unknown Source)

 

Nexus 3 uses OrientDB, and when the number of connections exceeds the database max connection pool size, it causes Nexus to hang.

 

Solution

To resolve this issue you need to update the Nexus search script with tx.close() and increase the OrientDB max connection pool size.

  1. To update the search script, log in to the Nexus Repository Manager (http://hostname:8081/) as admin and perform the following:

    1. Click the Server Administration and Configuration button.

    2. Select the API option from the System menu.

    3. Click Update stored script by name.

    4. Enter search in the name box and update the stored script with tx.close() in the body text box.

      If you do not have the search script, you can copy and paste the following updated search script that includes tx.close() after tx.commit():

      { "name": "search", "content": "import org.sonatype.nexus.repository.storage.Query; import org.sonatype.nexus.repository.storage.StorageFacet; import org.sonatype.nexus.repository.storage.Query.Builder; import groovy.json.JsonOutput; import groovy.json.JsonSlurper; def search = new JsonSlurper().parseText(args); log.info('search arguments: ' + args); def repositoryId = search.repositoryId; def groupId = search.g; def artifactId = search.a; def version = search.v; def data = []; def repo = repository.repositoryManager.get(repositoryId); StorageFacet storageFacet = repo.facet(StorageFacet); def tx = storageFacet.txSupplier().get(); tx.begin(); def builder = Query.builder(); if(groupId != null){ builder.where('group = ').param(groupId); }; if(version != null){ if(builder.hasWhere()){ builder.and('version = ').param(version); }else{ builder.where('version = ').param(version); } }; if(artifactId != null){ artifactId =[artifactId]; log.info('artifactId: ' + artifactId); if(builder.hasWhere()){ builder.and('name in ').param(artifactId); }else{ builder.where('name in ').param(artifactId); } }; def query = builder.build() ; log.info('query: ' + query.getParameters()); log.info('query: ' + query.getWhere()); def components = tx.findComponents(query , [repo]); components.each{ ArtifactResult artifact = new ArtifactResult(); artifact.groupId = it.attributes().child('maven2').get('groupId'); artifact.artifactId = it.attributes().child('maven2').get('artifactId'); artifact.version = it.attributes().child('maven2').get('baseVersion'); artifact.extension = it.attributes().child('maven2').get('packaging'); artifact.last_updated = it.lastUpdated(); artifact.description = it.attributes().child('maven2').get('pom_description'); log.info('search arguments: ' + it.attributes()); log.info('search getProperties: ' + it.getProperties()); log.info('search getEntityMetadata: ' + it.getEntityMetadata()); log.info('search getMetaPropertyValues: ' + it.getMetaPropertyValues()); data << artifact; }; tx.commit(); tx.close(); return JsonOutput.toJson(data); class ArtifactResult{ String groupId; String artifactId; String version; String extension; String last_updated; String description; } ", "type": "groovy" }
    5. Click the Try it out button to update the script.

      steps_updatescript.png

       

  2. Increase the OrientDB max connection pool size.

    1. Edit the system.properties file located at C:\Talend\7.x.x\tac\Artifact-Repository-Nexus-3.15.2-01-win64\nexus-3.15.2-01\etc\karaf.

    2. Add the db.pool.max=1000 property as the last line.

    3. Save the file and restart Nexus.

Version history
Revision #:
13 of 13
Last update:
‎05-08-2020 03:35 PM
Updated by: