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

Warn about timeout error in bigger images & better error handling session in readme #34

Closed
tsirlucas opened this issue Sep 10, 2018 · 6 comments
Labels

Comments

@tsirlucas
Copy link

tsirlucas commented Sep 10, 2018

Is your feature request related to a problem? Please describe.
First of all, congratulations! I'm running this project on a migration script for my company and it's helping us to extract exifData from 300k+ images.

Problem: It's running on a aws batch script. It started to just stop, exiting with an 0 code and I though that it might be related to the cpu (I was only using 2 vcpus), memory and stuff related to machine limitation. Spent some time improving the script and running it on a docker container with limited resources to replicate the environment and nothing changed.
In the end, the problem was that the image was too big and would take more than 10 seconds to extract its exifData.

Describe the solution you'd like
Took a deeper dive on your readme today and saw the error handling session... I think it could have a code sample and some kind of highlight to warn the users to use it to get proper error logs. In my case, I had to throw the error on the node script so the aws batch could set it as failed instead of success. Also had to increase the timeout with the taskTimeoutMillis param.

I think this project should have some kind of warning to tell users that are dealing with bigger images that they probably would like to increase the task timeout. Also, warning them about the error logging and creating a code sample showing how to handle errors would be good.

I can open a PR if you guys are too busy.

@mceachen
Copy link
Member

I'm happy to take PRs that add or clarify the docs. If you update jsdocs in the code, realize you'll need to yarn docs to build those changes into the tree.

If you think there's a code change is warranted, again, PRs are welcome.

I'm surprised that the file size would affect latency, though--most all files I've seen (even > 1GB) don't take a long time to return, because I use the (default) "-fast" option that returns as soon as the metadata headers are fully read. What kind of file was it choking on? Can you post it someplace so I can see?

@tsirlucas
Copy link
Author

Hey @mceachen, I don't think I can share the file because the one I'm talking about is from my production database. I'll ask my CTO if that's okay and get back to you. What I can tell is that it is a 2.6mb image, It has some different colours and contrasts, so it may be the reason?

I don't think any code changes will be needed. My fix was only add the taskTimeoutMillis with a value of 30000 when calling the ExifTool constructor. Once my CTO gives me a feedback, I will be able to maybe help you in this case so we can provide documentation for the use case. Sounds good?

@mceachen
Copy link
Member

mceachen commented Sep 11, 2018

That's not a large image--my Google Pixel regularly takes images that large. If you don't want to share the image, can you share the results of time exiftool <file> on the machine that's having the issue? (You'll need to apt get install exiftool or whatever's appropriate for your server, and the results of time are important, not the metadata).

If you're getting timeouts, I'd bet it's from IO timeouts from disks being overtaxed.

@tsirlucas
Copy link
Author

tsirlucas commented Sep 11, 2018

Removed the image description but that's the output with metadata (Maybe it can help?).

ExifTool Version Number         : 11.10
File Name                       : 2f1e45b9-85b7-4eaa-9205-13fc24b310e7.jpg
Directory                       : exif_images
File Size                       : 2.7 MB
File Modification Date/Time     : 2018:09:10 18:01:07-03:00
File Access Date/Time           : 2018:09:10 19:01:14-03:00
File Inode Change Date/Time     : 2018:09:10 18:37:00-03:00
File Permissions                : rw-r--r--
File Type                       : JPEG
File Type Extension             : jpg
MIME Type                       : image/jpeg
Exif Byte Order                 : Little-endian (Intel, II)
X Resolution                    : 72
Y Resolution                    : 72
Resolution Unit                 : inches
Software                        : Adobe Photoshop Lightroom 6.7 (Macintosh)
Modify Date                     : 2017:09:29 00:28:37
Exif Version                    : 0230
Create Date                     : 2015:10:01 18:30:38
Color Space                     : sRGB
Compression                     : JPEG (old-style)
Thumbnail Offset                : 720
Thumbnail Length                : 13772
Displayed Units X               : inches
Displayed Units Y               : inches
Current IPTC Digest             : e7759db7a16f2a0c47884de0fc4ddd4a
Coded Character Set             : UTF8
Application Record Version      : 4
Digital Creation Date           : 2015:10:01
Digital Creation Time           : 18:30:38+02:00
Photoshop Thumbnail             : (Binary data 13772 bytes, use -b option to extract)
IPTC Digest                     : e7759db7a16f2a0c47884de0fc4ddd4a
Profile CMM Type                : Linotronic
Profile Version                 : 2.1.0
Profile Class                   : Display Device Profile
Color Space Data                : RGB
Profile Connection Space        : XYZ
Profile Date Time               : 1998:02:09 06:49:00
Profile File Signature          : acsp
Primary Platform                : Microsoft Corporation
CMM Flags                       : Not Embedded, Independent
Device Manufacturer             : Hewlett-Packard
Device Model                    : sRGB
Device Attributes               : Reflective, Glossy, Positive, Color
Rendering Intent                : Perceptual
Connection Space Illuminant     : 0.9642 1 0.82491
Profile Creator                 : Hewlett-Packard
Profile ID                      : 0
Profile Copyright               : Copyright (c) 1998 Hewlett-Packard Company
Profile Description             : sRGB IEC61966-2.1
Media White Point               : 0.95045 1 1.08905
Media Black Point               : 0 0 0
Red Matrix Column               : 0.43607 0.22249 0.01392
Green Matrix Column             : 0.38515 0.71687 0.09708
Blue Matrix Column              : 0.14307 0.06061 0.7141
Device Mfg Desc                 : IEC http://www.iec.ch
Device Model Desc               : IEC 61966-2.1 Default RGB colour space - sRGB
Viewing Cond Desc               : Reference Viewing Condition in IEC61966-2.1
Viewing Cond Illuminant         : 19.6445 20.3718 16.8089
Viewing Cond Surround           : 3.92889 4.07439 3.36179
Viewing Cond Illuminant Type    : D50
Luminance                       : 76.03647 80 87.12462
Measurement Observer            : CIE 1931
Measurement Backing             : 0 0 0
Measurement Geometry            : Unknown
Measurement Flare               : 0.999%
Measurement Illuminant          : D65
Technology                      : Cathode Ray Tube Display
Red Tone Reproduction Curve     : (Binary data 2060 bytes, use -b option to extract)
Green Tone Reproduction Curve   : (Binary data 2060 bytes, use -b option to extract)
Blue Tone Reproduction Curve    : (Binary data 2060 bytes, use -b option to extract)
XMP Toolkit                     : Adobe XMP Core 5.6-c128 79.159124, 2016/03/18-14:01:55
Creator Tool                    : Adobe Photoshop Lightroom 6.7 (Macintosh)
Metadata Date                   : 2017:09:29 00:28:37+02:00
Format                          : image/jpeg
Instance ID                     : xmp.iid:e5c26564-7325-48f5-9f22-18767b701fad
Document ID                     : xmp.did:e5c26564-7325-48f5-9f22-18767b701fad
Original Document ID            : xmp.did:41ca6476-16f3-4804-a8da-8d74719324cc
Has Extended XMP                : 9A92AFFF0EBBFF007475D826604357EB
History Action                  : created, converted, saved, derived, saved
History Instance ID             : xmp.iid:41ca6476-16f3-4804-a8da-8d74719324cc, xmp.iid:1d94cdef-d526-44d6-9fba-37f9049dd810, xmp.iid:e5c26564-7325-48f5-9f22-18767b701fad
History When                    : 2015:10:01 18:30:38+02:00, 2015:10:06 02:45:37+02:00, 2017:09:29 00:28:37+02:00
History Software Agent          : Adobe Photoshop CC 2014 (Macintosh), Adobe Photoshop CC 2014 (Macintosh), Adobe Photoshop Lightroom 6.7 (Macintosh)
History Parameters              : from application/vnd.adobe.photoshop to image/tiff, converted from image/tiff to image/jpeg, saved to new location
History Changed                 : /, /
Derived From Instance ID        : xmp.iid:1d94cdef-d526-44d6-9fba-37f9049dd810
Derived From Document ID        : adobe:docid:photoshop:8c1da50b-ac2b-1178-8397-f92411606913
Derived From Original Document ID: xmp.did:41ca6476-16f3-4804-a8da-8d74719324cc
DCT Encode Version              : 100
APP14 Flags 0                   : [14], Encoded with Blend=1 downsampling
APP14 Flags 1                   : (none)
Color Transform                 : YCbCr
Image Width                     : 1500
Image Height                    : 1200
Encoding Process                : Baseline DCT, Huffman coding
Bits Per Sample                 : 8
Color Components                : 3
Y Cb Cr Sub Sampling            : YCbCr4:4:4 (1 1)
Version                         : 9.7
Process Version                 : 6.7
White Balance                   : Custom
Auto White Version              : 134348800
Incremental Temperature         : +3
Incremental Tint                : 0
Saturation                      : 0
Sharpness                       : 21
Luminance Smoothing             : 0
Color Noise Reduction           : 0
Vignette Amount                 : 0
Shadow Tint                     : 0
Red Hue                         : +18
Red Saturation                  : +20
Green Hue                       : 0
Green Saturation                : -9
Blue Hue                        : -3
Blue Saturation                 : 0
Vibrance                        : -9
Hue Adjustment Red              : +3
Hue Adjustment Orange           : 0
Hue Adjustment Yellow           : -9
Hue Adjustment Green            : 0
Hue Adjustment Aqua             : 0
Hue Adjustment Blue             : 0
Hue Adjustment Purple           : 0
Hue Adjustment Magenta          : 0
Saturation Adjustment Red       : +1
Saturation Adjustment Orange    : -2
Saturation Adjustment Yellow    : -20
Saturation Adjustment Green     : -11
Saturation Adjustment Aqua      : +26
Saturation Adjustment Blue      : -40
Saturation Adjustment Purple    : -100
Saturation Adjustment Magenta   : -10
Luminance Adjustment Red        : +15
Luminance Adjustment Orange     : +4
Luminance Adjustment Yellow     : -53
Luminance Adjustment Green      : +30
Luminance Adjustment Aqua       : +14
Luminance Adjustment Blue       : +5
Luminance Adjustment Purple     : 0
Luminance Adjustment Magenta    : 0
Split Toning Shadow Hue         : 76
Split Toning Shadow Saturation  : 2
Split Toning Highlight Hue      : 35
Split Toning Highlight Saturation: 7
Split Toning Balance            : -60
Parametric Shadows              : +32
Parametric Darks                : +25
Parametric Lights               : 0
Parametric Highlights           : +28
Parametric Shadow Split         : 25
Parametric Midtone Split        : 50
Parametric Highlight Split      : 75
Sharpen Radius                  : +1.1
Sharpen Detail                  : 19
Sharpen Edge Masking            : 0
Post Crop Vignette Amount       : 0
Grain Amount                    : 10
Grain Size                      : 0
Grain Frequency                 : 18
Lens Profile Enable             : 0
Lens Manual Distortion Amount   : -2
Perspective Vertical            : 0
Perspective Horizontal          : 0
Perspective Rotate              : +1.8
Perspective Scale               : 100
Perspective Aspect              : 0
Perspective Upright             : 0
Perspective X                   : 0.00
Perspective Y                   : 0.00
Auto Lateral CA                 : 0
Exposure 2012                   : -0.10
Contrast 2012                   : +62
Highlights 2012                 : -13
Shadows 2012                    : -92
Whites 2012                     : -30
Blacks 2012                     : -11
Clarity 2012                    : +5
Defringe Purple Amount          : 0
Defringe Purple Hue Lo          : 30
Defringe Purple Hue Hi          : 70
Defringe Green Amount           : 0
Defringe Green Hue Lo           : 40
Defringe Green Hue Hi           : 60
Dehaze                          : 0
Tone Map Strength               : 0
Convert To Grayscale            : False
Tone Curve Name                 : Linear
Tone Curve Name 2012            : Custom
Camera Profile                  : Embedded
Lens Profile Setup              : LensDefaults
Upright Version                 : 151388160
Upright Center Mode             : 0
Upright Center Norm X           : 0.5
Upright Center Norm Y           : 0.5
Upright Focal Mode              : 0
Upright Focal Length 35mm       : 35
Upright Preview                 : False
Upright Transform Count         : 6
Upright Four Segments Count     : 0
Grain Seed                      : 1335615867
Has Settings                    : True
Crop Top                        : 0.063657
Crop Left                       : 0.067509
Crop Bottom                     : 0.96199
Crop Right                      : 0.944283
Crop Angle                      : 0.314452
Crop Constrain To Warp          : 0
Has Crop                        : True
Already Applied                 : True
Tone Curve                      : 0, 0, 255, 255
Tone Curve Red                  : 0, 0, 255, 255
Tone Curve Green                : 0, 0, 255, 255
Tone Curve Blue                 : 0, 0, 255, 255
Tone Curve PV2012               : 0, 13, 47, 44, 96, 88, 146, 134, 196, 183, 255, 233
Tone Curve PV2012 Red           : 0, 0, 51, 49, 129, 126, 255, 255
Tone Curve PV2012 Green         : 0, 0, 46, 44, 127, 124, 255, 255
Tone Curve PV2012 Blue          : 0, 0, 122, 120, 255, 255
Retouch Area Heal Version       : +1
Retouch Area Spot Type          : clone
Retouch Area Source State       : sourceAutoComputed
Retouch Area Method             : gaussian
Retouch Area Source X           : 0.128478
Retouch Area Offset Y           : 0.974427
Retouch Area Opacity            : 1.000000
Retouch Area Feather            : 0.000000
Retouch Area Seed               : +2
Retouch Area Mask What          : Mask/Paint
Retouch Area Mask Value         : 1.000000
Retouch Area Mask Radius        : 0.001525
Retouch Area Mask Flow          : 1.000000
Retouch Area Mask Center Weight : 0.500000
Retouch Area Mask Dabs          : d 0.134201 0.974084
Warning                         : [Minor] Extracted only 1000 crs:PaintBasedCorrectionsCorrectionMasksDabs items. Ignore minor errors to extract all
Paint Correction What           : Correction
Paint Correction Amount         : 1.000000
Paint Correction Active         : true
Paint Correction Sharpness      : 0.226381
Paint Correction Brightness     : 0.000000
Paint Correction Hue            : 0.000000
Paint Correction Saturation     : 0.000000
Paint Correction Exposure 2012  : 0.000000
Paint Correction Contrast 2012  : 0.000000
Paint Correction Highlights 2012: 0.000000
Paint Correction Shadows 2012   : 0.000000
Paint Correction Clarity 2012   : 0.000000
Paint Correction Luminance Noise: 0.000000
Paint Correction Moire          : 0.000000
Paint Correction Defringe       : 0.000000
Paint Correction Temperature    : 0.000000
Paint Correction Tint           : 0.000000
Paint Correction Mask What      : Mask/Paint
Paint Correction Mask Value     : 0.873491
Paint Correction Mask Radius    : 0.020539
Paint Correction Mask Flow      : 0.433619
Paint Correction Mask Center Weight: 0.123235
Paint Correction Mask Dabs      : f 0.6229
Digital Creation Date/Time      : 2015:10:01 18:30:38+02:00
Image Size                      : 1500x1200
Megapixels                      : 1.8
Thumbnail Image                 : (Binary data 13772 bytes, use -b option to extract)
exiftool exif_images/2f1e45b9-85b7-4eaa-9205-13fc24b310e7.jpg  10.36s user 0.25s system 85% cpu 12.440 total

The image was saved on my HD (aws batch runs in machines with HD). After I moved it to my SSD, that's the difference:

exiftool exif_images/2f1e45b9-85b7-4eaa-9205-13fc24b310e7.jpg  7.47s user 0.11s system 97% cpu 7.774 total

@mceachen
Copy link
Member

mceachen commented Sep 11, 2018

10.36s user 0.25s system 85% cpu 12.440 total

That's crazy, I've never seen exiftool take that long just to extract metadata. And even on an SSD!

I'd submit this file to the ExifTool team, this smells like the file's format is so arcane it's getting ET's knickers in a bunch.

In any event, I set the timeout to 10s because that's 10x longer than I've ever seen ET take (even on 15 year old hardware). I guess I'll bump the default to 20s, but you can do this immediately in your own code if you instantiate your own ExifTool singleton.

@tsirlucas
Copy link
Author

I will se what I can do to submit the image.

About instantiate the singleton, I'm already doing it. Opened this issue just to let you know about the problem in this use case.

PS: This problem also happened with other images in our base. Increasing the taskTimeout solved it and the script ran gracefully.

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

No branches or pull requests

2 participants