You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by "d4x1 (via GitHub)" <gi...@apache.org> on 2023/12/18 04:11:21 UTC

[PR] fix(zentao): fix panic when checking db connections [incubator-devlake]

d4x1 opened a new pull request, #6649:
URL: https://github.com/apache/incubator-devlake/pull/6649

   ### ⚠️ Pre Checklist
   
   > Please complete _ALL_ items in this checklist, and remove before submitting
   
   - [x] I have read through the [Contributing Documentation](https://devlake.apache.org/community/).
   - [x] I have added relevant tests.
   - [x] I have added relevant documentation.
   - [x] I will add labels to the PR, such as `pr-type/bug-fix`, `pr-type/feature-development`, etc.
   
   <!--
   Thanks for submitting a pull request!
   
   We appreciate you spending the time to work on these changes.
   Please fill out as many sections below as possible.
   -->
   
   ### Summary
   What does this PR do?
   Revert #6633, Fix panic in another way.
   
   ### Does this close any open issues?
   Closes N/A
   
   ### Screenshots
   Include any relevant screenshots here.
   
   ### Other Information
   Any other information that is important to this PR.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(zentao): fix panic when checking db connections [incubator-devlake]

Posted by "klesh (via GitHub)" <gi...@apache.org>.
klesh commented on code in PR #6649:
URL: https://github.com/apache/incubator-devlake/pull/6649#discussion_r1429497599


##########
backend/core/runner/db.go:
##########
@@ -165,6 +165,11 @@ func CheckDbConnection(dbUrl string, d time.Duration) errors.Error {
 	result := make(chan errors.Error, 1)
 	done := make(chan struct{}, 1)
 	go func() {
+		defer func() {
+			if err := recover(); err != nil {
+				result <- errors.Default.New("panic when checking database connections")

Review Comment:
   please pass down the err or the information will be lost



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(zentao): fix panic when checking db connections [incubator-devlake]

Posted by "d4x1 (via GitHub)" <gi...@apache.org>.
d4x1 commented on code in PR #6649:
URL: https://github.com/apache/incubator-devlake/pull/6649#discussion_r1429538396


##########
backend/core/runner/db.go:
##########
@@ -165,6 +165,11 @@ func CheckDbConnection(dbUrl string, d time.Duration) errors.Error {
 	result := make(chan errors.Error, 1)
 	done := make(chan struct{}, 1)
 	go func() {
+		defer func() {
+			if err := recover(); err != nil {
+				result <- errors.Default.New("panic when checking database connections")

Review Comment:
   the error will be something like this:
   ![image](https://github.com/apache/incubator-devlake/assets/5844806/7af24245-b5f0-41aa-a676-bea179f98048)
   
   It contains some stack info, do you think we should return it to caller?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(zentao): fix panic when checking db connections [incubator-devlake]

Posted by "abeizn (via GitHub)" <gi...@apache.org>.
abeizn merged PR #6649:
URL: https://github.com/apache/incubator-devlake/pull/6649


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(zentao): fix panic when checking db connections [incubator-devlake]

Posted by "d4x1 (via GitHub)" <gi...@apache.org>.
d4x1 commented on code in PR #6649:
URL: https://github.com/apache/incubator-devlake/pull/6649#discussion_r1429538396


##########
backend/core/runner/db.go:
##########
@@ -165,6 +165,11 @@ func CheckDbConnection(dbUrl string, d time.Duration) errors.Error {
 	result := make(chan errors.Error, 1)
 	done := make(chan struct{}, 1)
 	go func() {
+		defer func() {
+			if err := recover(); err != nil {
+				result <- errors.Default.New("panic when checking database connections")

Review Comment:
   the error will be something like this:
   ![image](https://github.com/apache/incubator-devlake/assets/5844806/7af24245-b5f0-41aa-a676-bea179f98048)
   
   It contains some stack info, do you think we should return it to caller?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org