Sony Alpha Series Freezes

classic Classic list List threaded Threaded
47 messages Options
123
Reply | Threaded
Open this post in threaded view
|

Sony Alpha Series Freezes

Tyler W.
This post was updated on .
I'm posting this under dev because I'm not sure this is a bug yet, but as far as I can tell it qualifies.

I'm using both the Sony Alpha 6000 and Alpha 7r. I've tested my code with libgphoto2 versions 2.5.5 and 2.5.6.

I wrote some code that takes timelapse and every so often the program hangs and eventually gets stuck in this state. To rule out a bug in my code, I tested it using the gphoto2 command gphoto2 -I 2 -F 100 --capture-image-and-download --file "%Y%m%d%H%M%S.jpg". This ended up with the same problem.

You can hear the shutter, but gp_camera_capture is returning an error which results in an empty file (for my program) or no file at all (using gphoto2 CLI) being generated. The function returns after about 20 seconds then repeats leaving an empty file every 20 seconds.

I'll be happy to provide any error logs I can. Also, if anyone can verify this result it would be great.
Reply | Threaded
Open this post in threaded view
|

Re: Sony Alpha Series Freezes

Marcus Meissner-4
On Sun, Jan 11, 2015 at 02:09:56AM -0700, Tyler W. wrote:

> Before I start I'll apologize for my poor attempt at brevity. I do try. and
>
> Also, I'm posting this under dev because I'm not sure this is a bug yet, but
> as far as I can tell it qualifies.
>
> I'm using both the Sony Alpha 6000 and Alpha 7r. I've tested my code with
> libgphoto2 versions 2.5.5 and 2.5.6.
>
> I wrote some code that takes timelapse while turning on and off autofocus
> every few images. Every so often the program hangs and eventually gets stuck
> in this state. I thought it was my code until I tested it using the gphoto2
> command /gphoto2 -I 2 -F 100 --capture-image-and-download --file
> "%Y%m%d%H%M%S.jpg"/. This ended up with the same problem. You can hear the
> shutter, but gp_camera_capture is returning an error which results in an
> empty file (for my program) or no file at all (for the command line) being
> generated. This appears to repeat itself indefinitely if it doesn't resume
> normally after the first occurrence.
>
> I have seen some posts with similar problems for other/older cameras, but it
> seems those issues were patched. Can anyone check this result? It seems to
> occur more frequently with autofocus enabled and has taken me as many as 275
> pictures to get it to occur (more often ~50 pictures does it).

I just ran above commandline 3 times with my Sony SLT A58 and it did not show
this behaviour.

Is there anything special set otherwise?


The Sony capture support is different from other cameras, so it is probably
a different issue than with other camera brands.

 
> Quick side question here.
>
> As for contexts, when a camera is initialized it takes a context and a
> camera. I'm assuming for my purposes (timelapse & toggle autofocus) there's
> no reason I /must/ reinitialize the camera, although there may be good times
> to do so. I'm also assuming the same context pointer can and should be
> passed repeatedly to various camera function calls. Does this sound
> reasonable?

Yes, the context can be used several times. It is basically a backchannel
from the library to you for logging and reporting.

The camera also does only need to be initialized once as long as it does
not get powered down.

Ciao, Marcus

------------------------------------------------------------------------------
New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
GigeNET is offering a free month of service with a new server in Ashburn.
Choose from 2 high performing configs, both with 100TB of bandwidth.
Higher redundancy.Lower latency.Increased capacity.Completely compliant.
http://p.sf.net/sfu/gigenet
_______________________________________________
Gphoto-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gphoto-devel
Reply | Threaded
Open this post in threaded view
|

Re: Sony Alpha Series Freezes

Tyler W.
This post has NOT been accepted by the mailing list yet.
Marcus Meissner-4 wrote
I just ran above commandline 3 times with my Sony SLT A58 and it did not show
this behaviour.

Is there anything special set otherwise?


The Sony capture support is different from other cameras, so it is probably
a different issue than with other camera brands.
Nothing special is set. I did a factory reset of the Alpha 6000 and only set the time/date and the default USB interface to PC Remote. The same thing occurred.

The Dropbox link has debug logs for a few photos and a ~2 min video of the camera seizing. I used --debug-loglevel=error and --debug-loglevel=all and saved files from a single photo that returned successfully and again that threw an error. I'll add the --list-all-config output when I get a minute. I'm still trying to work my way through the source code, but let me know if there's anything specific I can check/upload.

https://www.dropbox.com/sh/ayc4wqxr72w63i0/AABo85eJ_duwrTz4AGAWOyPWa?dl=0

Thanks,

-Tyler
Reply | Threaded
Open this post in threaded view
|

Re: Sony Alpha Series Freezes

AlexN
I've been seeing a similar problem with a Sony A7R.  When capturing and downloading images at set intervals, gphoto occasionally seems to hang for ~20-30 seconds, then writes an empty file.

Not sure what might be useful for debugging this, but I'm happy to test/provide output if someone can suggest what would help.

I suspect it may be a problem with the camera firmware itself ...
Reply | Threaded
Open this post in threaded view
|

Re: Sony Alpha Series Freezes

Tyler W.
AlexN wrote
I suspect it may be a problem with the camera firmware itself ...
I was afraid this was the case too. So I hopped on a windows machine and downloaded Sony's Remote Camera Control software. I ran 200 photos with the a6000 and the problem never presented. I'm not saying Sony couldn't have made a mistake, but it seems they managed to make their hardware/software compatible.
Reply | Threaded
Open this post in threaded view
|

Re: Sony Alpha Series Freezes

Marcus Meissner-4
On Thu, Jan 15, 2015 at 11:34:22AM -0700, Tyler W. wrote:
> AlexN wrote
> > I suspect it may be a problem with the camera firmware itself ...
>
> I was afraid this was the case too. So I hopped on a windows machine and
> downloaded  Sony's Remote Camera Control software
> <http://esupport.sony.com/US/p/swu-download.pl?mdl=ILCE7&upd_id=9294&os_group_id=6>
> . I ran 200 photos with the a6000 and the problem never presented. I'm not
> saying Sony couldn't have made a mistake, but it seems they managed to make
> their hardware/software compatible.

Yes, there is probably a bug somewhere in or triggered by the libgphoto2 code :/

Have to dig in ...

Ciao, Marcus

------------------------------------------------------------------------------
New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
GigeNET is offering a free month of service with a new server in Ashburn.
Choose from 2 high performing configs, both with 100TB of bandwidth.
Higher redundancy.Lower latency.Increased capacity.Completely compliant.
http://p.sf.net/sfu/gigenet
_______________________________________________
Gphoto-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gphoto-devel
Reply | Threaded
Open this post in threaded view
|

Re: Sony Alpha Series Freezes

Marcus Meissner-4
On Fri, Jan 16, 2015 at 09:29:53AM +0100, Marcus Meissner wrote:

> On Thu, Jan 15, 2015 at 11:34:22AM -0700, Tyler W. wrote:
> > AlexN wrote
> > > I suspect it may be a problem with the camera firmware itself ...
> >
> > I was afraid this was the case too. So I hopped on a windows machine and
> > downloaded  Sony's Remote Camera Control software
> > <http://esupport.sony.com/US/p/swu-download.pl?mdl=ILCE7&upd_id=9294&os_group_id=6>
> > . I ran 200 photos with the a6000 and the problem never presented. I'm not
> > saying Sony couldn't have made a mistake, but it seems they managed to make
> > their hardware/software compatible.
>
> Yes, there is probably a bug somewhere in or triggered by the libgphoto2 code :/
>
> Have to dig in ...

I removed one part in the event loop that did too much work.

My Sony now survives for 600 images at least.

http://www.lst.de/~mm/libgphoto2-2.5.6.1.tar.bz2

for a test snapshot tarball.

Ciao, Marcus

------------------------------------------------------------------------------
New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
GigeNET is offering a free month of service with a new server in Ashburn.
Choose from 2 high performing configs, both with 100TB of bandwidth.
Higher redundancy.Lower latency.Increased capacity.Completely compliant.
http://p.sf.net/sfu/gigenet
_______________________________________________
Gphoto-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gphoto-devel
Reply | Threaded
Open this post in threaded view
|

Re: Sony Alpha Series Freezes

AlexN
Marcus, thank you for the very prompt attention.  I tried the updated library version 2.5.7 this morning.  Unfortunately, the error still occurs.  I've shared a full debug log file here: https://dl.dropboxusercontent.com/u/2718055/debug.log

Any other ideas?

Thanks,
Alex
Reply | Threaded
Open this post in threaded view
|

Re: Sony Alpha Series Freezes

Tyler W.
This fix seems to be work very well with autofocus disabled. Unfortunately the applications I'm responsible for require it, and when enabled, the bug still presents itself. Possibly a little more frequently now.

I haven't been able to trace the assignment for the camera->function->capture pointers. If it's not much trouble, would you mind sharing which file(s) were modified?

Without autofocus enabled it seems to be functioning really well. I'm using the a6000 right now and I've run a couple sets to 100 without a problem. I'm currently at 450/1000 on a longer test set and no issues so far!

Thanks,
-Tyler
Reply | Threaded
Open this post in threaded view
|

Re: Sony Alpha Series Freezes

Marcus Meissner-4
On Mon, Jan 19, 2015 at 01:26:17PM -0700, Tyler W. wrote:

> This fix seems to be work very well with autofocus disabled. Unfortunately
> the applications I'm responsible for require it, and when enabled, the bug
> still presents itself. Possibly a little more frequently now.
>
> I haven't been able to trace the assignment for the
> camera->function->capture pointers. If it's not much trouble, would you mind
> sharing which file(s) were modified?
>
> Without autofocus enabled it seems to be functioning really well. I'm using
> the a6000 right now and I've run a couple sets to 100 without a problem. I'm
> currently at 450/1000 on a longer test set and no issues so far!

camlibs/ptp2/library.c, function camera_sony_capture().

There is a for (tries = 0; tries < 100; tries++) { ... } loop doing the event polling,
which is the core part.

Ciao, Marcus

------------------------------------------------------------------------------
New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
GigeNET is offering a free month of service with a new server in Ashburn.
Choose from 2 high performing configs, both with 100TB of bandwidth.
Higher redundancy.Lower latency.Increased capacity.Completely compliant.
http://p.sf.net/sfu/gigenet
_______________________________________________
Gphoto-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gphoto-devel
Reply | Threaded
Open this post in threaded view
|

Re: Sony Alpha Series Freezes

Marcus Meissner-4
In reply to this post by AlexN
On Mon, Jan 19, 2015 at 12:10:46PM -0700, AlexN wrote:
> Marcus, thank you for the very prompt attention.  I tried the updated library
> version 2.5.7 this morning.  Unfortunately, the error still occurs.  I've
> shared a full debug log file here:
> https://dl.dropboxusercontent.com/u/2718055/debug.log
>
> Any other ideas?

Can you add this patch and see if that helps?

Ciao, Marcus

------------------------------------------------------------------------------
New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
GigeNET is offering a free month of service with a new server in Ashburn.
Choose from 2 high performing configs, both with 100TB of bandwidth.
Higher redundancy.Lower latency.Increased capacity.Completely compliant.
http://p.sf.net/sfu/gigenet
_______________________________________________
Gphoto-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gphoto-devel

xx.pat (510 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Sony Alpha Series Freezes

AlexN
No luck with this patch, the same thing happens.

If anything, the change to 2.5.7 has made the bug more consistent - my camera now stops successfully capturing images after fewer than 20 captures.

Just as an FYI compared to what Tyler has reported, I am using the camera in manual focus mode only - there is no auto-focus lens attached, and all settings are turned to manual (as far as I can tell within the Sony menus).

-Alex
Reply | Threaded
Open this post in threaded view
|

Re: Sony Alpha Series Freezes

Tyler W.
AlexN wrote
No luck with this patch, the same thing happens.
I was really hoping the A7r and a6000 would function identically. I just tested the A7r and did have the same problem regardless of autofocus setting. I'm going to test different values for the loops and usleep command and see if it changes anything.

Thanks,
-Tyler
Reply | Threaded
Open this post in threaded view
|

Re: Sony Alpha Series Freezes

Tyler W.
I'm trying not to spam the mailing list, but if I just edit my post this won't get sent out.

Alex - I have a fix for you to try. After Marcus pointed me to the right function (go to camlibs/ptp2/library.c, function camera_sony_capture like he said) I changed tries < 100 to tries < 800. Then a few lines down, reduced usleep to (10*100). I just ran a set of 1000 photos (AF enabled) with the A7r without an error. I assume you've been building from source so you can handle those easily. Let me know if I can help.

Also, feedback would be great if it does work. I did very little optimization of those numbers. 2-3 different attempts and I ended up with this. It may be really bad for other Sony cameras. I guess we'll find out, but I can only run the a6000 and A7r.

Marcus - Do you know of any issues that may arise from making a change like this?

Thanks,
-Tyler
Reply | Threaded
Open this post in threaded view
|

Re: Sony Alpha Series Freezes

Marcus Meissner-4
On Tue, Jan 20, 2015 at 10:13:46AM -0700, Tyler W. wrote:

> I'm trying not to spam the mailing list, but if I just edit my post this
> won't get sent out.
>
> Alex - I have a fix for you to try. After Marcus pointed me to the right
> function (go to camlibs/ptp2/library.c, function camera_sony_capture like he
> said) I changed tries < 100 to tries < 800. Then a few lines down, reduced
> usleep to (10*100). I just ran a set of 1000 photos (AF enabled) with the
> A7r without an error. I assume you've been building from source so you can
> handle those easily. Let me know if I can help.
>
> Also, feedback would be great if it does work. I did very little
> optimization of those numbers. 2-3 different attempts and I ended up with
> this. It may be really bad for other Sony cameras. I guess we'll find out,
> but I can only run the a6000 and A7r.
>
> Marcus - Do you know of any issues that may arise from making a change like
> this?

Actually no.

You can even remove the usleep() altogether.

The loop only polls USB interrupts, it does not do camera operations.

I needed to add sleeps for other cameras to avoid eating up their compute
time as they do not like rapid polling. But this loop no longer does that,
so its good.

I will change it to a while loop waiting up to 35 seconds (30 seconds is
max shuttertime here, and 5 seconds for saving the image).

Ciao, Marcus

------------------------------------------------------------------------------
New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
GigeNET is offering a free month of service with a new server in Ashburn.
Choose from 2 high performing configs, both with 100TB of bandwidth.
Higher redundancy.Lower latency.Increased capacity.Completely compliant.
http://p.sf.net/sfu/gigenet
_______________________________________________
Gphoto-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gphoto-devel
Reply | Threaded
Open this post in threaded view
|

Re: Sony Alpha Series Freezes

AlexN
So in my testing, I've found that reducing/eliminating that usleep() call does seem to make the "freeze" behavior happen less frequently, but it has not solved the problem.  In my application, I'm looking for up to ~5000 captures at a time, so it is important that the camera operate hands-off reliably!

What I'm still seeing is that once the camera enters this state, gphoto is able to trigger the shutter, but for whatever reason does not pull the images.  Once the camera's buffer is full, it also stops triggering.

In the loop that polls for USB interrupts, I've found that events are never returned after more than ~10 tries, with no dependence on the usleep() time.  So it seems more like the ptp_check_event() call is somehow missing the relevant interrupts coming from the camera (or the camera is not sending them as expected).

Marcus, I really want to get to the bottom of this, but the complexity of the library is a little daunting to me.  I would greatly welcome other suggestions on ways to attack this problem.

One thing that would help my application without fully solving the problem would be a way to reset the camera to get it out of this state.  Right now it seems that I must unplug/replug the USB to the camera to reset it.  Is there a library function or sequence that might simulate this to try to get the camera back to a happy state?

Many thanks,
Alex
Reply | Threaded
Open this post in threaded view
|

Re: Sony Alpha Series Freezes

Marcus Meissner-4
On Fri, Jan 23, 2015 at 02:41:28PM -0700, AlexN wrote:

> So in my testing, I've found that reducing/eliminating that usleep() call
> does seem to make the "freeze" behavior happen less frequently, but it has
> not solved the problem.  In my application, I'm looking for up to ~5000
> captures at a time, so it is important that the camera operate hands-off
> reliably!
>
> What I'm still seeing is that once the camera enters this state, gphoto is
> able to trigger the shutter, but for whatever reason does not pull the
> images.  Once the camera's buffer is full, it also stops triggering.
>
> In the loop that polls for USB interrupts, I've found that events are never
> returned after more than ~10 tries, with no dependence on the usleep() time.
> So it seems more like the ptp_check_event() call is somehow missing the
> relevant interrupts coming from the camera (or the camera is not sending
> them as expected).
>
> Marcus, I really want to get to the bottom of this, but the complexity of
> the library is a little daunting to me.  I would greatly welcome other
> suggestions on ways to attack this problem.
>
> One thing that would help my application without fully solving the problem
> would be a way to reset the camera to get it out of this state.  Right now
> it seems that I must unplug/replug the USB to the camera to reset it.  Is
> there a library function or sequence that might simulate this to try to get
> the camera back to a happy state?

I currently have not much more ideas. (On question... This is just JPEG capture?
Or dual JPEG+RAW?)

for resetting...
        gphoto2 --reset

will send a USB reset to the device. Similar to replugging it.

Ciao, Marcus

------------------------------------------------------------------------------
New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
GigeNET is offering a free month of service with a new server in Ashburn.
Choose from 2 high performing configs, both with 100TB of bandwidth.
Higher redundancy.Lower latency.Increased capacity.Completely compliant.
http://p.sf.net/sfu/gigenet
_______________________________________________
Gphoto-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gphoto-devel
Reply | Threaded
Open this post in threaded view
|

Re: Sony Alpha Series Freezes

Marcus Meissner-4
In reply to this post by AlexN
On Fri, Jan 23, 2015 at 02:41:28PM -0700, AlexN wrote:

> So in my testing, I've found that reducing/eliminating that usleep() call
> does seem to make the "freeze" behavior happen less frequently, but it has
> not solved the problem.  In my application, I'm looking for up to ~5000
> captures at a time, so it is important that the camera operate hands-off
> reliably!
>
> What I'm still seeing is that once the camera enters this state, gphoto is
> able to trigger the shutter, but for whatever reason does not pull the
> images.  Once the camera's buffer is full, it also stops triggering.
>
> In the loop that polls for USB interrupts, I've found that events are never
> returned after more than ~10 tries, with no dependence on the usleep() time.
> So it seems more like the ptp_check_event() call is somehow missing the
> relevant interrupts coming from the camera (or the camera is not sending
> them as expected).
>
> Marcus, I really want to get to the bottom of this, but the complexity of
> the library is a little daunting to me.  I would greatly welcome other
> suggestions on ways to attack this problem.

I have added some recovery code.

Drawback is that the camera waits 35 seconds (time the event poll loop will take)
until getting to this recovery point currently.

Ciao, Marcus

Index: library.c
===================================================================
--- library.c (revision 15333)
+++ library.c (working copy)
@@ -3296,9 +3302,10 @@
  propval.u16 = 1;
  C_PTP (ptp_sony_setdevicecontrolvalueb (params, 0xD2C1, &propval, PTP_DTC_UINT16));
 
- if (!newobject)
- return GP_ERROR;
-
+ if (!newobject) {
+ GP_LOG_E("no object found during event polling. try the 0xffffc001 object id");
+ newobject = 0xffffc001;
+ }
  /* FIXME: handle multiple images (as in BurstMode) */
  C_PTP (ptp_getobjectinfo (params, newobject, &oi));
 

------------------------------------------------------------------------------
New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
GigeNET is offering a free month of service with a new server in Ashburn.
Choose from 2 high performing configs, both with 100TB of bandwidth.
Higher redundancy.Lower latency.Increased capacity.Completely compliant.
http://p.sf.net/sfu/gigenet
_______________________________________________
Gphoto-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gphoto-devel
Reply | Threaded
Open this post in threaded view
|

Re: Sony Alpha Series Freezes

AlexN
In reply to this post by Marcus Meissner-4
Marcus Meissner-4 wrote
I currently have not much more ideas. (On question... This is just JPEG capture?
Or dual JPEG+RAW?)
I've seen this happen both with JPEG capture and with RAW capture.  I haven't tried dual JPEG+RAW mode.

Marcus Meissner-4 wrote
for resetting...
        gphoto2 --reset

will send a USB reset to the device. Similar to replugging it.
Thanks, I will try this today.
Reply | Threaded
Open this post in threaded view
|

Re: Sony Alpha Series Freezes

AlexN
AlexN wrote
Marcus Meissner-4 wrote
for resetting...
        gphoto2 --reset

will send a USB reset to the device. Similar to replugging it.
Thanks, I will try this today.
Reset did not have the same effect as unplugging and replugging.  I can see the reset in my kernel log:

Jan 26 22:02:14 host4 kernel: [ 9578.350304] usb 2-1.7: reset high-speed USB device number 14 using ehci-pci

However, instead of allowing more captures, gphoto segfaults on the next attempt to take photos:

Jan 26 22:02:19 host4 kernel: [ 9583.778496] gphoto2[10723]: segfault at 5 ip 00007f0cf2625d90 sp 00007fff16eeace0 error 4 in ptp2.so[7f0cf25f0000+8c000]

-Alex
123