Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug Report: Java Cgroup Detection Fails in wodby/solr on some cgroupv2 systems #22

Open
gene-miller opened this issue Feb 5, 2025 · 13 comments

Comments

@gene-miller
Copy link

wodby/solr:8-4.18.2 fails to detect cgroups properly on cgroupv2 systems, causing Java to throw a NullPointerException:

docker run --rm wodby/solr:8-4.18.2 java -XshowSettings:system -version

as a temporary work around -XX:-UseContainerSupport can be used:

docker run --rm wodby/solr:8-4.18.2 java -XX:-UseContainerSupport -XshowSettings:system -version

Seen on Arch linux.

@csandanov
Copy link
Member

Are you running it with zookeeper (solr cloud mode)? Could you try testing with newly built 9-5.0.0 image

@gene-miller
Copy link
Author

Thanks Chingis,

Yes we're running zookeeper although I believe this error occurs before any connection to zookeeper is attempted.

9-5.0.0.0 does not show the Cgroup error but it seems to suffer from other problems:

"error":{                                                                  
      "metadata":["error-class","org.apache.solr.common.SolrException","root-  
  error-class","org.apache.solr.common.SolrException"],                        
      "msg":"Underlying core creation failed while creating collection: defau  
  lt",                                                                         
      "code":400                                                               
    }   
Caused by: org.apache.solr.common.SolrException:  Error loading class 'solr.ICUCollationField'

@csandanov
Copy link
Member

Could you please clarify how exactly you're running it. Do you run init action after Solr startup (this actually creates the default collection)? What env vars do you set for Solr? Where did you get this error from? From admin UI?

@gene-miller
Copy link
Author

We are using the following command:

docker compose exec -T solr solr auth enable -type basicAuth -credentials solr:SolrRocks true -z zookeeper:2181 -blockUnknown true

Error can be seen in the container logs.

@adubovskoy
Copy link

adubovskoy commented Feb 17, 2025

I got same error.
Based on compose.yml, from https://github.com/wodby/docker4drupal/blob/master/compose.yml

drush search-api-solr:upload-configset solr_server --numShards=1:

[DEBUGGEN] [search_api] [2025-02-17T20:48:06] Get ClusterStatus for collection default failed with error code 400: Solr HTTP error: OK (400)
{
  "responseHeader":{
    "status":400,
    "QTime":2
  },
  "error":{
    "metadata":["CLUSTERSTATUS","NOT_FOUND","error-class","org.apache.solr.common.SolrException","root-error-class","org.apache.solr.common.SolrException"],
    "msg":"Collection: default not found",
    "code":400
  }
} | uid: 0 | request-uri: http://default/ | refer:  | ip:  127.0.0.1 | link: 

In StandardSolrCloudConnector.php line 409:
                                                                               
  Creating collection default failed with error code 400: Solr HTTP error: OK  
   (400)                                                                       
  {                                                                            
    "responseHeader":{                                                         
      "status":400,                                                            
      "QTime":460                                                              
    },                                                                         
    "error":{                                                                  
      "metadata":["error-class","org.apache.solr.common.SolrException","root-  
  error-class","org.apache.solr.common.SolrException"],                        
      "msg":"Underlying core creation failed while creating collection: defau  
  lt",                                                                         
      "code":400                                                               
    }                                                                          
  }                                                                            
                                                                               

In Result.php line 73:
                                                                               
  Solr HTTP error: OK (400)                                                    
  {                                                                            
    "responseHeader":{                                                         
      "status":400,                                                            
      "QTime":460                                                              
    },                                                                         
    "error":{                                                                  
      "metadata":["error-class","org.apache.solr.common.SolrException","root-  
  error-class","org.apache.solr.common.SolrException"],                        
      "msg":"Underlying core creation failed while creating collection: defau  
  lt",                                                                         
      "code":400                                                               
    }                                                                          
  }                                                                            

@csandanov
Copy link
Member

csandanov commented Feb 19, 2025

ok, 9-5.1.0 tag released with a few fixes

first of all you should add a new env to Solr service to enable lib directive, otherwise configset upload won't work from drupal

SOLR_OPTS: "-Dsolr.config.lib.enabled=true"

after solr and zookeeper both started you should run docker compose exec solr sh -c 'make init -f /usr/local/bin/actions.mk', this will create default collection and sets the auth to the default solr:SolrRocks

@gene-miller
Copy link
Author

Thanks Chingis, however I'm still seeing issues with 9-5.1.0.

This command: docker compose exec -T solr solr auth enable --type basicAuth --credentials solr:SolrRocks true -z zookeeper:2181 --block-unknown true

results in:

Cannot write to file: /opt/solr/server/solr/basicAuth.conf

Add the following lines to the solr.in.sh file so that the ./solr script can use subsequently.

SOLR_AUTH_TYPE="basic"
SOLR_AUTHENTICATION_OPTS="-Dbasicauth=solr:SolrRocks"

@csandanov
Copy link
Member

My bad, I pushed the tag without pushing fixes first. Released 5.1.1

@csandanov
Copy link
Member

regarding your command – which would probably still fail with 5.1.1 – that's not how this image designed to enable auth

see init action for how we do it:

solr zk cp file:/security.json zk:/security.json

whatever you're writing to /opt will be lost after container restart

@gene-miller
Copy link
Author

Testing 9-5.1.1 I found the following issues:

  • No default collection on initial startup
  • Creating a collection fails with Unable to create core [default_shard1_replica_n1] Caused by: solr.ICUCollationField (tested via the UI and with the command drush search-api-solr:upload-configset --waitForFinalState --numShards=1 solr)
  • Security->Permissions seems to be missing a bunch of permissions compared to the previous images

@csandanov
Copy link
Member

Thank you for testing, I released two tags:

  • 5.1.1 with corrected permissions to fix the security warnings in the UI
  • 5.1.2 to set SOLR_ZK_CREDS_AND_ACLS in solr.in.sh to explicitly set credentials injector and ACL provider for zookeeper that removes warnings during init action's solr zk copy

Now, what changed is Solr API Solr released a new module version and now it's necessary to add the following env var to Solr:

SOLR_MODULES: extraction,langid,ltr,analysis-extras

But still, before all these fixed the default collection created for me without any issues during the init action, please note you have to manually call init action locally since we cannot tell when both zookeeper and solr fully started. This is how I test:

  • clone latest docker4drupal from master branch
  • uncomment zookeeper and solr service in compose.yml
  • run make to start containers
  • after all started I run:
$ docker compose exec solr sh -c 'make init -f /usr/local/bin/actions.mk'
init_solr localhost
No collections found, creating a default collection
make[1]: Entering directory '/opt/solr-9.8.0'
echo "Creating collection default with default config"
Creating collection default with default config
curl -sIN "http://localhost:8983/solr/admin/collections?action=CREATE&name=default&numShards=1&collection.configName=_default" | head -n 1 | awk '{print $2}' | grep -q 200
make[1]: Leaving directory '/opt/solr-9.8.0'
neither jattach nor jstack in /opt/java/openjdk could be found, so no thread dumps are possible. Continuing.
Neither --zk-host or --solr-url parameters provided so assuming solr url is http://localhost:8983.
Copying from 'file:/security.json' to 'zk:/security.json'. ZooKeeper at zookeeper:2181
  • open solr UI, log in as admin and check collections, I see default collection created
  • now install search_api_solr module, enable it, add the server and upload configset
  • validating from drush:
$ drush search-api-solr:upload-configset --waitForFinalState --numShards=1 solr
 [success] Solr configset for solr uploaded.

@gene-miller
Copy link
Author

Thanks Chingis, 5.1.2 is looking good here.

Looks like the wait_solr executable has been removed from this image and replaced with wait-for-solr.sh correct?

@csandanov
Copy link
Member

correct

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants