Skip Menu |

This queue is for tickets about the Device-Chip-AnalogConverters CPAN distribution.

Report information
The Basics
Id: 133554
Status: resolved
Priority: 0/
Queue: Device-Chip-AnalogConverters

People
Owner: Nobody in particular
Requestors: leonerd-cpan [...] leonerd.org.uk
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.09
Fixed in: (no value)



Subject: Crash during concurrent ADC+GPIO access on MAX11200
Running the UI test program: $ pangoterm-no-stderr perl -Mblib examples/tickit-ui-adc.pl --chip MAX11200 --reference 2.048 ... it will often crash on an attempt to adjust GPIO pins if that coïncides with reading the ADC: BEGIN read_adc Show quoted text
>> BEGIN read_register(4) >> END read_register(4)
END read_adc Show quoted text
>> BEGIN read_register(2) >> END read_register(2) >> BEGIN command >> END command
BEGIN read_adc Show quoted text
>> BEGIN read_register(4) >> END read_register(4)
END read_adc Show quoted text
>> BEGIN read_register(2) >> END read_register(2) >> BEGIN command >> END command
BEGIN read_adc Show quoted text
>> BEGIN read_register(4) >> END read_register(4)
END read_adc Show quoted text
>> BEGIN read_register(2)
BEGIN write_gpios Show quoted text
>> BEGIN write_register(2)
Future=HASH(0x55c75bea4b08) is not yet complete and does not provide ->await at /home/leo/lib/perl5/App/Device/Chip/UI/GPIOBox.pm line 100. Show quoted text
>> END read_register(2)
Suspended async sub Device::Chip::MAX11200::_GPIOAdapter::read_gpios lost its returning future at /home/leo/src/perl/Device-Chip-AnalogConverters/blib/lib/Device/Chip/MAX11200.pm line 501. Show quoted text
>> END write_register(2)
END write_gpios Suspended async sub Device::Chip::MAX11200::_GPIOAdapter::write_gpios lost its returning future at /home/leo/src/perl/Device-Chip-AnalogConverters/blib/lib/Device/Chip/MAX11200.pm line 477. Attempt to free unreferenced scalar: SV 0x55c75bd08ff8, Perl interpreter: 0x55c75aa122a0 at /usr/share/perl5/Future.pm line 406. Attempt to free unreferenced scalar: SV 0x55c75bd04f08, Perl interpreter: 0x55c75aa122a0 at /usr/share/perl5/Future.pm line 406. Attempt to free unreferenced scalar: SV 0x55c75bce9818, Perl interpreter: 0x55c75aa122a0 at /usr/share/perl5/Future.pm line 633. Attempt to free unreferenced scalar: SV 0x55c75bd08ff8, Perl interpreter: 0x55c75aa122a0 at /usr/share/perl5/Future.pm line 633. -- Paul Evans
On Sun Oct 18 08:09:55 2020, PEVANS wrote: Show quoted text
> it will often crash on an attempt to adjust GPIO pins if that > coïncides with reading the ADC:
Actually, it seems it doesn't matter what the concurrent activity races with. Various runs: BEGIN trigger + BEGIN command BEGIN write_gpios + BEGIN write_register(2) Future=HASH(0x559e165a3498) is not yet complete and does not provide ->await at /home/leo/lib/perl5/App/Device/Chip/UI/GPIOBox.pm line 100. + END command END trigger BEGIN trigger + BEGIN command + END command END trigger BEGIN write_gpios + BEGIN write_register(2) BEGIN read_adc + BEGIN read_register(4) Future=HASH(0x558a46ef7a88) is not yet complete and does not provide ->await at examples/tickit-ui-adc.pl line 228. + END write_register(2) END write_gpios + END read_register(4) END read_adc -- Paul Evans
Further poking: This seems to relate to what the Future turn type is from the function. my $f = $chip->read_adc_ratio; print STDERR "->read_adc_ratio f=$f\n"; $result = sprintf "ADC voltage $format", $value = $f->get * $REFERENCE; Gives result: BEGIN trigger + BEGIN command + END command END trigger BEGIN read_adc + BEGIN read_register(4) ->read_adc_ratio f=IO::Async::Future=HASH(0x555d76172328) + END read_register(4) END read_adc + BEGIN read_register(2) + END read_register(2) BEGIN write_gpios + BEGIN write_register(2) + END write_register(2) END write_gpios BEGIN trigger + BEGIN command + END command END trigger BEGIN write_gpios + BEGIN write_register(2) BEGIN read_adc + BEGIN read_register(4) ->read_adc_ratio f=Future=HASH(0x555d761733e8) Future=HASH(0x555d761733e8) is not yet complete and does not provide ->await at examples/tickit-ui-adc.pl line 230. A normal result gives IO::Async::Future but during a collision here it returns a plain Future instance instead. -- Paul Evans
Two parts to this bug: 1) Crashes on concurrency due to RT133563. That has an easy fix. 2) Complaints about "Attempt to free unreferenced scalar" are likely a Future::AsyncAwait bug; still investigating. -- Paul Evans
On Mon Oct 19 12:16:59 2020, PEVANS wrote: Show quoted text
> 2) Complaints about "Attempt to free unreferenced scalar" are likely a > Future::AsyncAwait bug; still investigating.
Appears to be from the combination of Future::AsyncAwait + Object::Pad. Reported as https://rt.cpan.org/Ticket/Display.html?id=133564 -- Paul Evans
On Mon Oct 19 13:14:14 2020, PEVANS wrote: Show quoted text
> On Mon Oct 19 12:16:59 2020, PEVANS wrote:
> > 2) Complaints about "Attempt to free unreferenced scalar" are likely a > > Future::AsyncAwait bug; still investigating.
> > Appears to be from the combination of Future::AsyncAwait + Object::Pad. > Reported as https://rt.cpan.org/Ticket/Display.html?id=133564
RT133564 now has a patch. Will be fixed in next release of Future-AsyncAwait. -- Paul Evans