bitnami / charts

Bitnami Helm Charts
https://bitnami.com
Other
9.01k stars 9.22k forks source link

sonarqube/logs/sonar.log: no such file or directory #14892

Closed satya1302 closed 1 year ago

satya1302 commented 1 year ago

Name and Version

bitnami/sonarqube:2.1.0

What steps will reproduce the bug?

Previously I am using sonarqube helm chart 2.0.1 which is running fine. I would like to increase max http post size to 32 MB. with the following values

jvmOpts:
  SONARQUBE_WEB_JVM_OPTS: "-Xmx512m -XX:MaxMetaspaceSize=256m -Dsonar.web.port=9000 -Dsonar.web.javaAdditionalOpts=-Dserver.max-http-post-size=33554432"

but I got some error with unable to restart the elasticsearch container but I browsed the web and found that I need to upgrade the helm chart to the latest version 2.1.0 which solved that issue but a new issue has come up Screenshot 2023-02-15 at 14 33 11

but I have that file(sonar.log) in my container, I have also checked the ReadWrite permissions Screenshot 2023-02-15 at 14 28 32 . I have also checked the memory requests which are given as 2GiB with cpu 100MiB. I found this issue which is very similar to my issue https://github.com/bitnami/charts/issues/8030

can someone please help resolve this issue?

What do you see instead?

I should see the sonarqube running successfully instead sonarqube container running in crashloopbackoff status

carrodher commented 1 year ago

It seems a very specific use case difficult to reproduce on our side and very tied to your scenario.

For information regarding the application itself, customization of the content within the application, or questions about the use of the technology or infrastructure; we highly recommend checking forums and user guides made available by the project behind the application or the technology.

That said, we will keep this ticket open until the stale bot closes it just in case someone from the community adds some valuable info.

github-actions[bot] commented 1 year ago

This Issue has been automatically marked as "stale" because it has not had recent activity (for 15 days). It will be closed if no further activity occurs. Thanks for the feedback.

github-actions[bot] commented 1 year ago

Due to the lack of activity in the last 5 days since it was marked as "stale", we proceed to close this Issue. Do not hesitate to reopen it later if necessary.

diegoluisi commented 1 year ago

Same problem.

sonarqube 11:32:07.26
sonarqube 11:32:07.26 Welcome to the Bitnami sonarqube container
sonarqube 11:32:07.26 Subscribe to project updates by watching https://github.com/bitnami/containers
sonarqube 11:32:07.26 Submit issues and feature requests at https://github.com/bitnami/containers/issues
sonarqube 11:32:07.27
sonarqube 11:32:07.29 INFO  ==> Validating settings in POSTGRESQL_CLIENT_* env vars
sonarqube 11:32:07.41 INFO  ==> Creating SonarQube configuration
sonarqube 11:32:07.61 INFO  ==> Trying to connect to the database server
sonarqube 11:32:07.69 INFO  ==> Ensuring SonarQube directories exist
sonarqube 11:32:07.76 INFO  ==> Starting SonarQube in background
sonarqube 11:32:07.91 INFO  ==> Waiting for SonarQube to start...
grep: /opt/bitnami/sonarqube/logs/sonar.log: No such file or directory
grep: /opt/bitnami/sonarqube/logs/sonar.log: No such file or directory
grep: /opt/bitnami/sonarqube/logs/sonar.log: No such file or directory
danscarf commented 1 year ago

Same problem for me:

image

The directory and file does seem to exist

sonarqube@sonarqube-1685371696-58558f8f4c-bltc9:/opt/bitnami/sonarqube/logs$ ls -al
total 32
drwxrwxr-x 1 sonarqube root      4096 May 29 15:05 .
drwxrwxr-x 1 root      root      4096 May 21 16:32 ..
-rw-rw-r-- 1 sonarqube root        88 May 20 01:53 README.txt
-rw-r--r-- 1 sonarqube sonarqube 5643 May 29 15:06 es.log
-rw-r--r-- 1 sonarqube sonarqube 1525 May 29 15:06 nohup.log
-rw-r--r-- 1 sonarqube sonarqube 1170 May 29 15:06 sonar.log
sonarqube@sonarqube-1685371696-58558f8f4c-bltc9:/opt/bitnami/sonarqube/logs$ find /opt/bitnami/sonarqube/logs/sonar.log
/opt/bitnami/sonarqube/logs/sonar.log
sonarqube@sonarqube-1685371696-58558f8f4c-bltc9:/opt/bitnami/sonarqube/logs$ 
github-actions[bot] commented 1 year ago

This Issue has been automatically marked as "stale" because it has not had recent activity (for 15 days). It will be closed if no further activity occurs. Thanks for the feedback.

maytan-cogo commented 1 year ago

I'm facing the same issue. Have tried multiple chart versions(recent) and both packaged postgres and external. The log file exists in all cases.

sonarqube 05:24:36.40 
sonarqube 05:24:36.40 Welcome to the Bitnami sonarqube container
sonarqube 05:24:36.40 Subscribe to project updates by watching https://github.com/bitnami/containers
sonarqube 05:24:36.40 Submit issues and feature requests at https://github.com/bitnami/containers/issues
sonarqube 05:24:36.40 
sonarqube 05:24:36.41 INFO  ==> Validating settings in POSTGRESQL_CLIENT_* env vars
sonarqube 05:24:36.44 INFO  ==> Creating SonarQube configuration
sonarqube 05:24:36.47 INFO  ==> Trying to connect to the database server
sonarqube 05:24:36.50 INFO  ==> Ensuring SonarQube directories exist
sonarqube 05:24:36.56 INFO  ==> Starting SonarQube in background
sonarqube 05:24:36.59 INFO  ==> Waiting for SonarQube to start...
grep: /opt/bitnami/sonarqube/logs/sonar.log: No such file or directory
grep: /opt/bitnami/sonarqube/logs/sonar.log: No such file or directory

Here's my postgres and sonarqube chart values:

bitnami/postgres (version: 12.5.7)

global:
  imageRegistry: public.ecr.aws
architecture: standalone
auth:
  database: sonarqube
  username: sonarqube
  existingSecret: some-credentials
  secretKeys:
    adminPasswordKey: password
    userPasswordKey: password
primary:
  resources:
    limits:
      memory: 256Mi
      cpu: 250m
metrics:
  enabled: true
  serviceMonitor:
    enabled: true

bitnami/sonarqube (version: 3.2.3)

global:
  imageRegistry: public.ecr.aws
existingSecret: some-credentials
sonarqubeUsername: sonarqube
replicaCount: 1
minHeapSize: 1024m
maxHeapSize: 2048m
resources:
  limits:
    memory: 2.5Gi
    cpu: 500m
podAntiAffinityPreset: hard
service:
  type: NodePort
persistence:
  enabled: true
metrics:
  jmx:
    enabled: true
  serviceMonitor:
    enabled: true
postgresql:
  enabled: false
externalDatabase:
  host: postgresql
  user: sonarqube
  existingSecret: some-credentials
bandirom commented 1 year ago

The same issue

Opened the file sonar.log

image

kcasas commented 1 year ago

@satya1302 @diegoluisi @danscarf @maytan-cogo It may seem that /opt/bitnami/sonarqube/logs/sonar.log is the issue here but really it's ElasticSearch not starting properly. Read the contents of /opt/bitnami/sonarqube/logs/sonar.log and it will show the main error message.

Screenshot 2023-06-29 at 12 36 40 AM

The fix that worked for me is increasing memory limit to 4Gi

resources:
  limits:
    memory: 4Gi

@bandirom Your issue is different and is related to how to upgrade properly. Read the upgrade guide.

FraPazGal commented 1 year ago

Hi all! Thank you everyone for your reports. I'll work on reproducing this error internally and check if the fix proposed by @kcasas (thank you for that!) mitigates it. Also, please share here if you try the proposed solution and your results.

@bandirom I'm not sure your error comes from the same scenario as it seems it is upgrade-related. Feel free to check our upgrade section and open a new issue if your issue is indeed unrelated to the one discussed here.

bandirom commented 1 year ago

@kcasas @FraPazGal Hi!) Thank you for your attention!

I also received this error message in the pod logs and pod was stucked till restart (healthcheck probes).

But the file exist in the pod. When open log file, I had the text above.

github-actions[bot] commented 1 year ago

This Issue has been automatically marked as "stale" because it has not had recent activity (for 15 days). It will be closed if no further activity occurs. Thanks for the feedback.

github-actions[bot] commented 1 year ago

Due to the lack of activity in the last 5 days since it was marked as "stale", we proceed to close this Issue. Do not hesitate to reopen it later if necessary.

sonic-sw commented 1 year ago

Dear all,

I can report the same issue is still present in the current helm chart and start try with vanilla helm values.

the log report

2023.08.08 05:37:57 INFO  app[][o.s.a.AppFileSystem] Cleaning or creating temp directory /opt/bitnami/sonarqube/temp
2023.08.08 05:37:57 INFO  app[][o.s.a.es.EsSettings] Elasticsearch listening on [HTTP: 127.0.0.1:9001, TCP: 127.0.0.1:33397]
2023.08.08 05:37:57 INFO  app[][o.s.a.ProcessLauncherImpl] Launch process[ELASTICSEARCH] from [/opt/bitnami/sonarqube/elasticsearch]: /opt/bitnami/java/bin/java -Xms4m -Xmx64m -XX:+UseSerialGC -Dcli.name=server -Dcli.script=./bin/elasticsearch -Dcli.libs=lib/tools/server-cli -Des.path.home=/opt/bitnami/sonarqube/elasticsearch -Des.path.conf=/opt/bitnami/sonarqube/temp/conf/es -Des.distribution.type=tar -cp /opt/bitnami/sonarqube/elasticsearch/lib/*:/opt/bitnami/sonarqube/elasticsearch/lib/cli-launcher/* org.elasticsearch.launcher.CliToolLauncher
2023.08.08 05:37:57 INFO  app[][o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
2023.08.08 05:38:25 INFO  app[][o.s.a.SchedulerImpl] Process[es] is up
2023.08.08 05:38:25 INFO  app[][o.s.a.ProcessLauncherImpl] Launch process[WEB_SERVER] from [/opt/bitnami/sonarqube]: /opt/bitnami/java/bin/java -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djava.io.tmpdir=/opt/bitnami/sonarqube/temp -XX:-OmitStackTraceInFastThrow --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED --add-exports=java.base/jdk.internal.ref=ALL-UNNAMED --add-opens=java.base/java.nio=ALL-UNNAMED --add-opens=java.base/sun.nio.ch=ALL-UNNAMED --add-opens=java.management/sun.management=ALL-UNNAMED --add-opens=jdk.management/com.sun.management.internal=ALL-UNNAMED -Dcom.redhat.fips=false -Xmx512m -Xms128m -XX:+HeapDumpOnOutOfMemoryError -Dhttp.nonProxyHosts=localhost|127.*|[::1] -cp ./lib/sonar-application-10.1.0.73245.jar:/opt/bitnami/sonarqube/lib/jdbc/postgresql/postgresql-42.6.0.jar org.sonar.server.app.WebServer /opt/bitnami/sonarqube/temp/sq-process14797096435463720272properties
2023.08.08 05:38:34 INFO  app[][o.s.a.SchedulerImpl] Process[Web Server] is stopped
2023.08.08 05:38:34 INFO  app[][o.s.a.SchedulerImpl] Process[ElasticSearch] is stopped
2023.08.08 05:38:34 WARN  app[][o.s.a.p.AbstractManagedProcess] Process exited with exit value [ElasticSearch]: 143
2023.08.08 05:38:34 INFO  app[][o.s.a.SchedulerImpl] SonarQube is stopped

and then restart endlessly.

jotamartos commented 1 year ago

Hi @sonic-sw,

The grep: /opt/bitnami/sonarqube/logs/sonar.log: No such file or directory message is just a warning message caused by this line in the Sonarqube container

https://github.com/bitnami/containers/blob/main/bitnami/sonarqube/10/debian-11/rootfs/opt/bitnami/scripts/libsonarqube.sh#L248

The script waits for a message in the log while the application is being boot but it takes some time for the app to create that log file. After some seconds, the message disappears and the application starts correctly

$ k get pods
NAME                                 READY   STATUS    RESTARTS      AGE
pod/jota-sonarqube-fb5bf86b9-j6p5h   1/1     Running   1 (20m ago)   23m
pod/jota-sonarqube-postgresql-0      1/1     Running   0             23m

If you continue running into issues, please increase the resources of your cluster (note that Sonarqube requires a big amount of RAM to work, we configure 2GB for the container but you can try increasing this value to 4GB) or try launching the solution in a different environment.

Thanks

sonic-sw commented 1 year ago

Hello @jotamartos,

thank you for your response. The resources required is the key as you mentioned. Essentially it is not sonar which fails to start itself but elastic search. After I migrated the workload to a higher mem node, it started. It takes easy 5GB RAM with a small 2k line git project connected.

jotamartos commented 1 year ago

Hi @sonic-sw,

I'm glad to hear that the solution works properly now.

Enjoy!