Project

General

Profile

Actions

Bug #8670

closed

HAProxy PHP error

Added by Chris Macmahon over 6 years ago. Updated about 6 years ago.

Status:
Resolved
Priority:
Normal-package
Assignee:
-
Category:
haproxy
Target version:
Start date:
07/20/2018
Due date:
% Done:

0%

Estimated time:
Plus Target Version:
Affected Version:
2.4.4
Affected Plus Version:
Affected Architecture:
All

Description

On update to snapshot 2.4.4.a.20180718.2256:

HA Proxy errors with PHP:
PHP ERROR: Type: 1, File: /usr/local/pkg/haproxy/haproxy.inc, Line: 2722, Message: Uncaught Error: Cannot create references to/from string offsets in /usr/local/pkg/haproxy/haproxy.inc:2722
Stack trace:
#0 /usr/local/pkg/haproxy/haproxy.inc(910): get_backend_acls(Array, 'http')
#1 /usr/local/pkg/haproxy/haproxy.inc(1944): write_backend('/var/etc/haprox...', Resource id #51, 'observium_http_...', Array, Array)
#2 /usr/local/pkg/haproxy/haproxy.inc(2223): haproxy_writeconf('/var/etc/haprox...')
#3 /usr/local/pkg/haproxy/haproxy.inc(1173): haproxy_check_run(1)
#4 Standard input code(5): haproxy_configure()
#5 {main}

Actions #1

Updated by Jim Pingle over 6 years ago

  • Subject changed from HA Proxy to HAProxy PHP error
  • Category set to haproxy
  • Affected Version set to 2.4.4
  • Affected Architecture All added
  • Affected Architecture deleted ()
Actions #2

Updated by Pi Ba over 6 years ago

I suspect your using 'haproxy' package? Can you verify that haproxy-devel is working properly?

Actions #3

Updated by Chris Macmahon over 6 years ago

Yup, using Haproxy-Dev works. This is for PHP migration.

Actions #4

Updated by Jim Thompson over 6 years ago

  • Assignee set to Anonymous
  • Target version set to 2.4.4
Actions #5

Updated by King J over 6 years ago

I have also run in to this on 2.4.4.a.20180723.1255 and HAProxy 0.57_5. Upgrading to HAProxy-devel (0.59_1) as suggested above has also resolved the issue for me.

Actions #6

Updated by Anonymous over 6 years ago

This particular error has been fixed. It may, however, reveal more :(

Actions #7

Updated by Pi Ba over 6 years ago

If haproxy-devel package is working properly, then i should probably copy its components/fixes/features over to haproxy package.
Most if not all cases of php7 issues have been fixed in the -devel version (afaik). And if no bugs have been added it should be safe to copy the gui components over the stable version. I just always wonder if stuff really works properly, and tend to just include more changes into -devel when i start looking, and then again feel uncomfortable if it is the right moment to copy it over the stable package.. Anyhow no point in fixing the 'stable' version at this moment imho..

Ill send a PR, i guess we will find out.. :)

Actions #8

Updated by Chris Macmahon over 6 years ago

Found another:
PHP ERROR: Type: 1, File: /usr/local/pkg/haproxy/haproxy.inc, Line: 2859, Message: Uncaught Error: Cannot use string offset as an array in /usr/local/pkg/haproxy/haproxy.inc:2859
Stack trace:
#0 /usr/local/www/haproxy/haproxy_listeners.php(329): get_frontend_acls('A')
#1 {main}

Actions #9

Updated by → luckman212 over 6 years ago

Is this bug possibly causing this error as well?
https://www.reddit.com/r/PFSENSE/comments/92it0e/haproxy_setup_issue/e361t9q/

TL;DR - Under ACLs, "Server Name Indication TLS extension matches:" option does not appear for newly created FrontEnds

Actions #10

Updated by Anonymous over 6 years ago

  • Status changed from New to 13
Actions #11

Updated by Anonymous over 6 years ago

  • Status changed from 13 to In Progress
Actions #12

Updated by Anonymous over 6 years ago

  • Status changed from In Progress to Feedback
Actions #13

Updated by Anonymous over 6 years ago

It is not clear what this Redmine issue now means. It seems to have morphed into other errors (which may , or may not still exist) and it has blurred the lines between haproxy and haproxy-devel

Can we clarify this ticket, or close it and make a new one please?

Actions #14

Updated by Pi Ba over 6 years ago

The ACL issue from #9 was actually a 'user mistake', that was cleared on the forum.

This redmine ticket is i.m.o. about arrays and php7 on 2.4.4 being more strict than php5 with their usage.

It 'should' mostly work now, but i have still got some pending commits regarding the way of handling this..

Actions #15

Updated by Jim Pingle over 6 years ago

  • Status changed from Feedback to New

Yes, this is still about PHP7 array issues, and there are a few outstanding. Here is one that happens with a clean install of haproxy on a firewall that has never had haproxy before:

8:58:35 PHP ERROR: Type: 1, File: /usr/local/pkg/haproxy/haproxy.inc, Line: 2189, Message: Uncaught Error: Cannot create references to/from string offsets in /usr/local/pkg/haproxy/haproxy.inc:2189
Stack trace:
#0 /usr/local/pkg/haproxy/haproxy.inc(2226): haproxy_get_transparent_backends()
#1 /etc/inc/filter.inc(4375): haproxy_generate_rules('filter')
#2 /etc/inc/filter.inc(410): discover_pkg_rules('filter')
#3 /etc/rc.filter_configure_sync(29): filter_configure_sync()
#4 {main}
  thrown

Have a look at the new function I just added in https://github.com/pfsense/pfsense/commit/65b5efa73bb866f0642de640174fb7028a4fc604 -- it will create nested arrays for you only if they are not currently arrays. So it leaves existing settings alone but will make sure they exist before you use them.

For example that line in haproxy.inc is:

$a_backends = &$config['installedpackages']['haproxy']['ha_pools']['item'];

With that function, you can do this:

init_config_arr(array('installedpackages', 'haproxy', 'ha_pools', 'item'));
$a_backends = &$config['installedpackages']['haproxy']['ha_pools']['item'];

It is only in 2.4.4 at the moment, so if you want to keep the same code on other branches you could either copy it with a function_exists() check or a version check before running it. That's a lot better than four levels of manual is_array() if/create array/blah sections.

Actions #16

Updated by Pi Ba over 6 years ago

I'm going to revisit all those items.. and get rid of this kind of array lookup completely replacing them with this single function call:
$a_backends = &getarraybyref($config,'installedpackages','haproxy','ha_pools','item');

My initial though of a central 'initialize' function preferably once on installation can not guarantee that stuff is and stays initialized. And to avoid cluttering the code with lots of !is_array(x) { x = array() } lines.. this is i guess the better option..

First i want be sure that 2.4.3 works properly though.. Next PR should probably not get backported immediately :)

Actions #17

Updated by Anonymous over 6 years ago

  • Status changed from New to Assigned
Actions #18

Updated by Pi Ba about 6 years ago

This issues with haproxy should be fixed with current 0.59_11 version. If not please let me know the exact error you get and when that happens.

Actions #19

Updated by Jim Pingle about 6 years ago

  • Status changed from Assigned to Feedback
  • Priority changed from Normal to Normal-package
Actions #20

Updated by Chris Macmahon about 6 years ago

I am no longer seeing these errors.

Actions #21

Updated by Chris Macmahon about 6 years ago

  • Status changed from Feedback to Resolved
Actions

Also available in: Atom PDF