world map feature -> fatal error

BASE-user
Chris Ryan
2008-06-17
2013-06-03
  • Chris Ryan

    Chris Ryan - 2008-06-17

    Hi,

    I'm trying to get the world map feature from base 1.4.1/cvs to a working condition.
    Every peace of further needed software from the readme is installed (debian: libgeo-ipfree-perl libgeo-ip-perl geoip-bin).
    Creation of any not-worldmap graphics is fine, only the world maps are involved.

    First error i get is:
    Fatal error: Allowed memory size of 52428800 bytes exhausted (tried to allocate 38 bytes) in /usr/share/acidbase/base_graph_common.php on line 638

    The memory limit of 50M seems to be too litte, so i raised it up 128M.
    For debian, the steps are:
    o check /usr/share/(acid)base/base_graph_common.php    
       -> ini_set("memory_limit", "128M");
    o check /etc/php5/apache2/php.ini and set            
       ->(memory_limit,upload_max_filesize, post_max_size)
    o check these values with phpinfo()

    With the higher memory values, the creation of the world map beginns, creates a black image, but then throws a lot of these error messages into the browser (not the apache log or sth):

    Warning: imagefilledpolygon() [function.imagefilledpolygon]: You must have at least 3 points in your array in /usr/share/php/Image/Canvas/GD.php on line 1004
    Warning: imagepolygon() [function.imagepolygon]: You must have at least 3 points in your array in /usr/share/php/Image/Canvas/GD.php on line 1023
    Warning: Cannot modify header information - headers already sent by (output started at /usr/share/php/Image/Canvas/GD.php:1004) in /usr/share/php/Image/Canvas.php on line 644   

    After the text errors is a text representation of the non-working png-file in binary.

    Is there anything else i can test or help to solve the problem?

    bye, Chris.

     
    • Juergen Leising

      Juergen Leising - 2008-06-17

      Hi Chris,

      the graphics are indeed incredibly memory hungry.  Well, 50 MB were sufficient for me,
      but nevertheless, I have increased the limit
      to 128 MB in CVS.  We will see whether this
      turns out to be a problem for anyone.

      As to the warnings: Normally they can safely be ignored. You could increase the

      "Minimum Threshold Value:"

      to 5 or 10 or even higher values.

      A different question is, why generating the png fails completely on your system.  There must be an error message anywhere, not just a warning.

      However, the whole PEAR::Image::Graph library is rather buggy, I must say.
      Unfortunately.  And the underlying
      GD library is also something that has
      produced headache to me.

      Can you tell me the exact versions that
      you use?

      Image::Graph,
      Image::Color,
      Image::Canvas and
      GD.

      "headers already sent" means normally,
      that there has been output an error message
      in text form, although a png was to be generated.  Of course, the error message
      does not fulfill the formal requirements
      of a png.  Well, I would be rather interested in this and all the other
      error message(s).

      Bye, bye

      Juergen

       
    • Chris Ryan

      Chris Ryan - 2008-06-17

      Hi,

      > As to the warnings: Normally they can safely be ignored. You could increase the
      > "Minimum Threshold Value:"
      > to 5 or 10 or even higher values.

      These words confused me in the readme earlier the day ...
      I had a closer look at this. The code delivered to my browser does contain these checkboxes, yet there were not displayed. The table is closed to soon.
      Some manueal editing even revealed the threshold (or "mindestwert"), locally.

      The page is malformed around here:
      > VALUE="Graph Alerts" align=center></div><BR><BR></TR></TABLE><TR><TD>
      Changed to:
      > VALUE="Graph Alerts" align=center></div><BR><BR></TR>    <TR>                                               

      I'll have a futher look at this in the morning.

      >Can you tell me the exact versions that
      >you use? 
      >Image::Graph, 
      >Image::Color, 
      >Image::Canvas and 
      >GD.

      To give a quick overview:
      Installed packages, channel pear.php.net:
      =========================================
      Package          Version State
      Image_Canvas     0.3.1   alpha
      Image_Color      1.0.2   stable
      Image_Graph      0.7.2   alpha
      Log              1.10.1  stable
      Numbers_Roman    1.0.2   stable
      Numbers_Words    0.15.0  beta
      PEAR             1.6.1   stable
      Structures_Graph 1.0.2   stable

      /usr/share/php/Image/Canvas/GD.php says:
      @version    CVS: $Id: GD.php,v 1.16 2007/06/22 20:19:54 nosey Exp

      I'll also have a look at this in the morning and present you some output with debugging enabled.
      Further i'll pass some diffs concerning the german translations to you.

      bye, Chris.

       
    • Chris Ryan

      Chris Ryan - 2008-06-18

      Hi,

      > present you some output with debugging enabled.

      I had that font issue in the apache logs:

      /usr/share/acidbase/base_graph_display.php:350: WARNING: Verdana could not be resolved into a readable font file. Check "Image/Canvas/Fonts/fontmap.txt" in your PEAR directory. This directory can be found by pear 'config-show | grep "PEAR directory"'. Falling back to default font without the possibility to adjust any font sizes, referer: https://ids.net.tu-ilmenau.de/base_graph_main.php

      I did a "apt-get install msttcorefonts" and change the /usr/share/php/Image/Canvas/Fonts/fontmap.txt to:
      Verdana,/usr/share/fonts/truetype/msttcorefonts/verdana.ttf
      Verdana Bold,/usr/share/fonts/truetype/msttcorefonts/verdanab.ttf
      Verdana Bold Italic,/usr/share/fonts/truetype/msttcorefonts/verdanaz.ttf
      Verdana Italic,/usr/share/fonts/truetype/msttcorefonts/verdanai.ttf

      With debugging enabled. everything looks fine:
      [error] [client] fontmap is located in /usr/share/php/Image/Canvas/Fonts/fontmap.txt, referer: https://base_graph_main.php
      [error] [client] single_filename = "/usr/share/fonts/truetype/msttcorefonts/verdana.ttf", referer: https://base_graph_main.php
      [error] [client] Found! File for font Verdana could be found!, referer: https://base_graph_main.php
      [error] [client] check_fontmap() returned 1, referer: https://base_graph_main.php

      But the generated image is still black.

      The generation of a graph starts normaly:

      Chart criteria

      Array
      (
          [0] =>
          [1] =>  1 = 1  AND (  timestamp >='2008-06-17 120000'  AND  timestamp <='2008-06-17 135959'  )
      )

      Where is the worldmap?
      "./Image/Graph/Images/Maps/world_map6.png"
      "/usr/share/php/Image/Graph/Images/Maps/world_map6.png"
      SELECT DISTINCT ip_src, COUNT(acid_event.cid) FROM acid_event WHERE 1 = 1 AND ( timestamp >='2008-06-17 120000' AND timestamp <='2008-06-17 135959' ) AND ip_src is NOT NULL GROUP BY ip_src ORDER BY ip_src

      country method 1: We use the database of Geo::IPfree

      Found: 4.184.247.168 belongs to US (United States): 4.23.4.0 - 9.19.255.255
      US (United States): 1 alerts
      [...] VERY MUCH of these [...]
      Found: 220.215.64.218 belongs to AU (Australia): 219.160.0.0 - 220.255.255.255
      AU (Australia): 1 alerts
      Found: 220.224.237.148 belongs to AU (Australia): 219.160.0.0 - 220.255.255.255
      AU (Australia): 1 alerts
      Found: 220.233.6.211 belongs to AU (Australia): 219.160.0.0 - 220.255.255.255
      AU (Australia): 1 alerts
      AU (Australia): 1 alerts
      AU (Australia): 1 alerts
      AU (Australia): 1 alerts
      AU (Australia): 3 alerts
      AU (Australia): 1 alerts
      AU (Australia): 2 alerts
      AU (Australia): 1 alerts
      chart_type = 15
      data_source =
      chart_interval = 0
      element_start = 0
      count($xdata) = 43
      Behandlungszeitraum, wenn nötig...
      i = 0
      element_start = 0
      number_array_elements = 43
      count(xdata) = 43

      count(xdata) = 43
      0 -- US (United States) - 1130
      1 -- CA (Canada) - 11
      2 -- NL (Netherlands) - 3
      3 -- AU (Australia) - 27
      4 -- KR (Korea, Republic of) - 3
      5 -- CN (China) - 173
      6 -- JP (Japan) - 5
      7 -- TW (Taiwan) - 2
      8 -- IT (Italy) - 14
      9 -- GB (United Kingdom) - 6
      10 -- CZ (Czech Republic) - 2
      11 -- EU (European Union) - 89
      12 -- ES (Spain) - 9
      13 -- DE (Germany) - 3415
      14 -- FR (France) - 2
      15 -- DK (Denmark) - 1
      16 -- -- (unknown) - 47
      17 -- PL (Poland) - 4
      18 -- BE (Belgium) - 4
      19 -- AT (Austria) - 21
      20 -- SE (Sweden) - 2
      21 -- HU (Hungary) - 2
      22 -- CH (Switzerland) - 173
      23 -- SI (Slovenia) - 11
      24 -- RU (Russian Federation) - 9
      25 -- IE (Ireland) - 1
      26 -- HR (Croatia) - 1
      27 -- PT (Portugal) - 1
      28 -- SK (Slovakia) - 2
      29 -- MT (Malta) - 1
      30 -- YU (Serbia and Montenegro) - 1
      31 -- BR (Brazil) - 1
      32 -- LA (Lao People's Democratic Republic) - 1
      33 -- ID (Indonesia) - 2
      34 -- HK (Hong Kong) - 2
      35 -- DM (Dominica) - 1
      36 -- UA (Ukraine) - 4
      37 -- GI (Gibraltar) - 1
      38 -- SA (Saudi Arabia) - 3
      39 -- GR (Greece) - 1
      40 -- TR (Turkey) - 1
      41 -- FI (Finland) - 1
      42 -- IR (Iran, Islamic Republic of) - 1
      Ausgabe der Grafik (600 x 400)

      At this point, there is NO further error message in the logs, and the black image is displayed.
      When i click on it to enlarge it, i get these errors and the "text binary" at the end...

      Warning: imagefilledpolygon() [function.imagefilledpolygon]: You must have at least 3 points in your array in /usr/share/php/Image/Canvas/GD.php on line 1004

      Warning: imagepolygon() [function.imagepolygon]: You must have at least 3 points in your array in /usr/share/php/Image/Canvas/GD.php on line 1023

      Warning: Cannot modify header information - headers already sent by (output started at /usr/share/php/Image/Canvas/GD.php:1004) in /usr/share/php/Image/Canvas.php on line 644

      Warning: Cannot modify header information - headers already sent by (output started at /usr/share/php/Image/Canvas/GD.php:1004) in /usr/share/php/Image/Canvas.php on line 645

      Warning: Cannot modify header information - headers already sent by (output started at /usr/share/php/Image/Canvas/GD.php:1004) in /usr/share/php/Image/Canvas.php on line 646

      Warning: Cannot modify header information - headers already sent by (output started at /usr/share/php/Image/Canvas/GD.php:1004) in /usr/share/php/Image/Canvas.php on line 647

      Warning: Cannot modify header information - headers already sent by (output started at /usr/share/php/Image/Canvas/GD.php:1004) in /usr/share/php/Image/Canvas/GD/PNG.php on line 104

      Warning: Cannot modify header information - headers already sent by (output started at /usr/share/php/Image/Canvas/GD.php:1004) in /usr/share/php/Image/Canvas/GD/PNG.php on line 105
      ‰PNG  ��� IHDR����‘���i×aI�� �IDATxœì½i|Eöÿ_77!$!!D YeQ@ŒD1,¢@@a…ù¡ŽÛ(3Ì0.ȸ0 ŒÃ ""‚ˆâƾ¯Ê"‘EÂ!ˆ!r„üܯý/N-]w¿—ûy?È«»ºêÔ9§N-]éîË������������DÆXeee¨Õ������������€ áp8bB­������������lŒ�����������¢lŒ�����������¢lŒ�����������¢lŒ�����
      [...]

      bye, Chris

       
    • Juergen Leising

      Juergen Leising - 2008-06-18

      Hello Chris,

      as far as the threshold setting is concerned, it can be found below
      the submit button, cf.

      http://img2.freeimagehosting.net/uploads/c07ef1b12f.png

      (link is active for a few days only)

      And with regard to the warnings, you get the warnings printed
      right to the screen, don't you?  If so, then this is bad,
      because apache has the error log right because of the fact
      that such warnings violate the html syntax or the form of a png.
      Of course, the browser refuses to display such a ruined png.

      A clear setup error, and we must try and find out how to fix this...

      Bye, bye

      Juergen

       
    • Juergen Leising

      Juergen Leising - 2008-06-18

      Do you have

               display_errors

      in your php.ini? If so, setting it to 0 could help, perhaps.

      Bye, bye

      Juergen

       
    • Chris Ryan

      Chris Ryan - 2008-06-18

      Hi,

      > as far as the threshold setting is concerned, it can be found below
      > the submit button, cf. 
      As i tried to explain above, there is no such button:
      http://img2.freeimagehosting.net/uploads/cde7cab58a.png
      The delivered html has some malformed tags, for some reason.
      Removing them recreates the buttons, but i didn't check the generation php, yet.

      > And with regard to the warnings, you get the warnings printed 
      > right to the screen, don't you? If so, then this is bad,
      Exactly. But some other errors i had earlier, i.e. font warnings (verdana), went directly and only to the apache error log.

      > A clear setup error, and we must try and find out how to fix this...
      I'm right behind you ;)

      Thanks & bye, Chris.

       
    • Chris Ryan

      Chris Ryan - 2008-06-18

      Hi,

      > display_errors
      > in your php.ini? If so, setting it to 0 could help, perhaps.

      Indeed. That seems to be the default with that apache2.2/php5 for debian.
      I'm pretty sure that i never touched that value.

      Setting it to 
      >display_errors = Off
      created me a world map.
      Stunning - big thanks!

      I'll check that missing checkboxes from above in the evening.

      bye, Chris.

       
    • Juergen Leising

      Juergen Leising - 2008-06-19

      > As i tried to explain above, there is no
      > such button:
      > http://img2.freeimagehosting.net/uploads/cde7cab58a.png

      Uh, oh, that must have happened by one of my last changes.  :-/

      Well, as usual, could you please update from CVS?  The controls below the submit button must appear from the very beginning on, of course.  Otherwise certain quirks with the
      PEAR::Image::Graph library could not be dealed with appropriately by the user.

      As far as the display_errors variable is concerned:  The image should now be able
      to be rendered correctly, even if this variable were set to "On".  I have simply
      set it to "Off" (0) inside BASE when (and only when) base_graph_display.php is called.

      So, please check, whether you can set $display_errors to 1 in your php.ini and
      at the same get a properly drawn world map.

      Bye, bye

      Juergen

       
    • Chris Ryan

      Chris Ryan - 2008-06-19

      Hi,

      > So, please check, whether you can set $display_errors to 1 in your php.ini and
      > at the same get a properly drawn world map.

      The form is fixed, now. Thanks. I was on my way to send you a patch on my own...

      With or without the global $display_errors set, a new error arises:

      "Es gibt keine Datenpunkte für die Grafik
      ERROR: $mycountry has not been set as expected."

      Bye, Chris.

       
    • Chris Ryan

      Chris Ryan - 2008-06-23

      >ERROR: $mycountry has not been set as expected."

      The error went away as it arised - for unknown reason ;o)
      Thanks for your efforts, Juergen!

      bye, Chris.

       
      • Juergen Leising

        Juergen Leising - 2008-06-23

        Hi Chris,

        yes, but there is indeed a bug: The code that produces the
        error message

        ERROR: $mycountry has not been set as expected.

        should have been inside the while loop rather than
        outside the loop.

        In cases when there are no datapoints to be drawn, the variable
        $mycountry does not get set, either.  But in this particular
        case it would not be an error condition.

        The message "There are no datapoints..." is no error at all.
        It may happen, that you choose a time frame or a starting point
        where there is really nothing to draw.

        I am going to update this in the coming days, as soon
        as cvs write access works again. 

        Bye, bye

        Juergen

         
    • Juergen Leising

      Juergen Leising - 2008-06-26

      Fixed in CVS, now. Please update.

      Bye, bye

      Juergen

       

Log in to post a comment.