php-fann icon indicating copy to clipboard operation
php-fann copied to clipboard

Win 10, PHP 5.6/7 crashes @ fann_train_on_file with "CLI has stopped working"

Open bfal opened this issue 9 years ago • 6 comments

I've tried installing the FANN 1.1.1, 1.1.0, 1.0.7 under PHP versions 5.6 & 7. Running the simple_train.php it crashes consistently at fann_train_on_file. Reducing $max_epochs makes it crash faster, reports never show up. running the xor_train.exe, simple_test.php does not crash.

bfal avatar Jul 23 '16 17:07 bfal

I installed php 5.3 and FANN 1.1.1. Sometimes it makes it through, most times it crashes the same.

bfal avatar Jul 23 '16 21:07 bfal

It appears to be related to the $epochs_between_reports setting. Changing it to 1 cause a crash every time. 0 or a huge number (more than $max_epochs) cause no crash and it completes. At no point does it show a report.

bfal avatar Jul 25 '16 15:07 bfal

I'm not really a win user but if you would be able to produce backtrace, I could possibly see when it crashes and help more or ping someone else who could possibly help:

See https://bugs.php.net/bugs-generating-backtrace-win32.php how to get backtrace on win.

bukka avatar Aug 02 '16 17:08 bukka

Thanks for the reply.

I believe I setup things correct but need a debug file for fandouble.dll? This is what I get:

Function Arg 1 Arg 2 Arg 3 Arg 4 Source fanndouble!fann_destroy+3c 008326b8 0122cb38 01232d44 547d09d4
php_fann!get_module+7a 010c84e0 01110430 000001f4 0122cb38
php5ts!zend_hash_del_key_or_index+ac 00000000 00000000 00000000 00000000

Exception Information FANNDOUBLE!FANN_DESTROY+3CWARNING - DebugDiag was not able to locate debug symbols for fanndouble.dll, so the information below may be incomplete.

In php__PID__15224__Date__08_02_2016__Time_06_33_05PM__391__Second_Chance_Exception_C0000005.dmp the assembly instruction at fanndouble!fann_destroy+3c in D:\test\fanndouble.dll has caused an access violation exception (0xC0000005) when trying to read from memory location 0x00000000 on thread 0

Module Information Image Name: D:\test\fanndouble.dll Symbol Type: Export Base address: 0x00905a4d Time Stamp: Mon Jan 23 10:05:47 2012
Checksum: 0x00000000 Comments:
COM DLL: False Company Name:
ISAPIExtension: False File Description:
ISAPIFilter: False File Version:
Managed DLL: False Internal Name:
VB DLL: False Legal Copyright:
Loaded Image Name: fanndouble.dll Legal Trademarks:
Mapped Image Name: Original filename:
Module name: fanndouble Private Build:
Single Threaded: False Product Name:
Module Size: 76.00 KBytes Product Version:
Symbol File Name: fanndouble.dll Special Build: &

bfal avatar Aug 02 '16 23:08 bfal

Sorry for the slightly late reply. Might be related to the compile fanndouble.dll.

@weltling If you have a little bit of spare time, would you be able to check this on win 10:

$num_input = 2;
$num_output = 1;
$num_layers = 3;
$num_neurons_hidden = 3;
$desired_error = 0.001;
$max_epochs = 500000;
$epochs_between_reports = 1;

$ann = fann_create_standard($num_layers, $num_input, $num_neurons_hidden, $num_output);

if ($ann) {
    fann_set_activation_function_hidden($ann, FANN_SIGMOID_SYMMETRIC);
    fann_set_activation_function_output($ann, FANN_SIGMOID_SYMMETRIC);

    $filename = dirname(__FILE__) . "/xor.data";
    if (fann_train_on_file($ann, $filename, $max_epochs, $epochs_between_reports, $desired_error))
        fann_save($ann, dirname(__FILE__) . "/xor_float.net");

    fann_destroy($ann);
}

if you can see any crash? I just tested and it works fine on Linux. Possibly if you have any other idea how to better debug it or what could be the cause, that would be great!

bukka avatar Aug 07 '16 19:08 bukka

@bukka you didn't link the file, so i took it ./examples/logic_gates/xor.data . With that on the current master, your snippet doesn't crash for me as well.

weltling avatar Sep 19 '16 14:09 weltling