comp.lang.ada
 help / color / mirror / Atom feed
From: Jerry <lanceboyle@qwest.net>
Subject: Re: ANN: PLplot plotting library with Ada bindings
Date: Wed, 13 Nov 2013 14:51:31 -0800 (PST)
Date: 2013-11-13T14:51:31-08:00	[thread overview]
Message-ID: <a17d28a2-2206-4239-9693-73db18cd18f0@googlegroups.com> (raw)
In-Reply-To: <7f8741ff-7585-487e-89bd-f941847df21e@googlegroups.com>

On Tuesday, November 12, 2013 8:27:37 AM UTC-7, Graham Stark wrote:
> Hi Jerry,
> 
> That looks really interesting.
> 
> I'm looking for a plotter routine that could be used safely inside the AWS web server, so I can implement a 'callback' chart server (currently I have one written in Java). 
> 
> Could this be used for that? Some simple tests suggest to me that it isn't thread safe. The  Initialize_PLplot and associated procedures to set filenames, etc, seem to set global variables somewhere. Is there some trick I'm missing?
> 
> It does make lovely looking charts.
> 
> 
> 
> thanks very much for this.
> 
> Graham

Hi Graham,

Thanks for your interest in PLplot. I don't know how to answer your question about thread safety so I put it to the PLplot developmenet list. There are two responses so far, from Alan and Hezekiah.

Jerry


====
Alan
====

To answer the question at hand, I am virtually positive PLplot is not thread safe, but you should wait for Andrew's response for the definitive view on that, especially the question of what would need to be done to make PLplot thread safe and ideally a plan for getting there.

Just as important as thread safety in my option is security. If I were a webserver designer interested in safe plotting, then it is important to acknowledge that plotting software by its very nature is inherently insecure; the problem is that plotting software has lots of different user input channels (titles, text annotations, legends, colorbars, etc.,) that could be the source of potential buffer overflows or other intrusion possibilities. We do make some concious decisions for PLplot development to avoid obvious security issues, but at the same time security is not our primary interest and certainly not a fundamentally important area of expertise for us. And I am sure that is the case for developers of other plotting software as well; we are all primarily interested in making pretty pictures ("lovely looking charts") rather than designing secure software. :-)

So for any plot software including PLplot, the web designer should filter down the possible user input channels as much as possible (ideally no user-controlled input text allowed at all). After that, a full security audit (only possible with open-source plotting software such as PLplot) should be done of what is left to target by a malicious user after such filtering. And we would certainly be happy to accept patches that were the result of any such audit.


========
Hezekiah
========

PLplot is not thread safe. While you can use PLplot in a threaded program, only one thread per process may interact with PLplot at a given time. This limitation holds even if you are working with multiple plot streams in a single process.

Regarding Alan's follow-up - while it is possible to make PLplot thread-safe, the changes required are invasive and pervasive. They are all good changes to make! But there is a lot to be done and the result is a completely backwards-incompatible API. The three big pieces required are:

a) All PLplot functions will need to explicitly operate on a given plstream value representing the affected plot stream. This requires adding an additional stream argument to all PLplot functions and removing any global state from plot streams. 
b) Remove all of the globals used through the PLplot code base in the actual plotting logic. One example is the contour/shading routines which use several global variables to track their state. 
c) Confirm/ensure that each of our output devices can be and are used in a thread-safe manner.

Each of these big pieces is made up of several smaller chunks. (a) is where the API breakage would come in. It is also likely the simplest (simple being relative here!) to complete. (b) could be pretty hairy as the logic in the contouring routines in particular is tricky to translate to something which doesn't use globals. (c) should be attainable for at least the Cairo, Qt and built-in output drivers (SVG, PS, null). I would be happy to help in putting together a plan for this work. Unfortunately my PLplot time is very limited these days so it's unlikely I'll be able to provide much development assistance.


  reply	other threads:[~2013-11-13 22:51 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-02  0:31 ANN: PLplot plotting library with Ada bindings Jerry
2013-10-02  0:45 ` Jeffrey Carter
2013-10-03  4:39   ` Anatoly Chernyshev
2013-10-03  5:27     ` Jeffrey Carter
2013-10-04 23:55   ` Jerry
2013-10-19  2:27     ` Randy Brukardt
2013-10-22  4:20       ` Jerry
2013-11-12 15:27 ` Graham Stark
2013-11-13 22:51   ` Jerry [this message]
2013-11-15  5:16   ` Jerry
2013-11-18 15:11     ` Graham Stark
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox