google-code-export / camlistore

Automatically exported from code.google.com/p/camlistore
Apache License 2.0
0 stars 0 forks source link

Broken image breaks search #402

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
When querying for images, a single broken image can cause the query to fail 
entirely.

Client:

$ camtool search is:pano
2014/03/13 01:47:03 Error: client: got status code 500 from URL 
https://localhost:3179/my-search/camli/search/query; body {
  "error": "file does not exist",
  "errorType": "Internal Server Error"
}

Server log:

2014/03/12 18:47:04 Sending error 500 to client for: file does not exist

If an image failed to decode then GetImageInfo returns a not-exists error. The 
indexer is handling this (though  displaying an error "index.GetImageInfo(file 
sha1-xxx) failed; index stale?"), but the query path isn't. When searching for 
images based on width, height, or ratio when the failed GetImageInfoLocked is 
hit it will fail the query instead of just filtering out the broken image.

The fix seems pretty straight forward.

diff --git a/pkg/search/query.go b/pkg/search/query.go
index b3109fa..e9516b0 100644
--- a/pkg/search/query.go
+++ b/pkg/search/query.go
@@ -1238,6 +1238,9 @@ func (c *FileConstraint) blobMatches(s *search, br 
blob.Ref, bm camtypes.BlobMet
                }
                imageInfo, err := corpus.GetImageInfoLocked(br)
                if err != nil {
+                       if os.IsNotExist(err) {
+                               return false, nil
+                       }
                        return false, err
                }
                width = int64(imageInfo.Width)

Original issue reported on code.google.com by samuel.stauffer on 13 Mar 2014 at 2:11

GoogleCodeExporter commented 9 years ago
I would like to begin contributing to this project. I decided to use this bug 
as an opportunity to learn a corner of the project. I have signed the CLA and 
have submitted a patch for code review to 
https://camlistore-review.googlesource.com/#/c/2496/
I apologize in advance if this is not the apporopriate contribution workflow 
and would greatly appreciate any feedback and guidance. Thanks! Josh

Original comment by joshuagay on 4 Apr 2014 at 12:45

GoogleCodeExporter commented 9 years ago

Original comment by bradfitz on 4 Apr 2014 at 5:01

GoogleCodeExporter commented 9 years ago
This issue has moved to https://camlistore.org/issue/402

Original comment by bradfitz on 14 Dec 2014 at 11:37