interpreter crashes at tooldata_find_index_for_tool

More
26 Sep 2021 08:39 #221620 by Reinhard
Hi,

I try to internally use the interpreter in a Qt-app and I hope, that it will be faster, than parsing text output from interpreter on my own.
As always I try to follow axis code ...
I use qtcreator with debugger to narrow the problem. In the loop of read/execute crash happens at execute with this stack-trace:
  1. tool_mmap_mutex_get (tooldata_mmap.cc #79)
  2. tooldata_find_index_for_tool (tooldata_mmap.cc #298)
  3. Interp::find_tool_index (interp_find.cc #722)
  4. Interp::convert_tool_select (interp_convert.cc #5704)
  5. Interp::execute_block (interp_execute.cc #300)
  6. Interp::_execute (rs274ngc_pre.cc #504)
  7. Interp::execute (rs274ngc_pre.cc #533)
I suppose, that its my fault, but I have no idea, where to start to search for.
For check I run axis with the same config/gcode-file and there's no problem.

In my java-app I use the ready compiled interpreter-executable, so I tried that too and got some strange result. I call the interpreter with "rs274 -g -v [var-file] -i [ini-file] -t [tool-table] -n 0 -l 999 2> error.log > log"
Here's the log:
    1 N..... USE_LENGTH_UNITS(CANON_UNITS_MM)
    2 N..... SET_G5X_OFFSET(1, 8165.0024, 12700.0000, -5080.0000, 0.0000, 0.0000, 0.0000)
    3 N..... SET_G92_OFFSET(3004.1677, 209.2678, 78.7400, 0.0000, 0.0000, 0.0000)
    4 N..... SET_XY_ROTATION(0.0000)
    5 N..... SET_FEED_REFERENCE(CANON_XYZ)
    6 N..... ON_RESET()
    7 N..... SELECT_PLANE(CANON_PLANE_XY)
    8 N..... USE_LENGTH_UNITS(CANON_UNITS_MM)
    9 N..... COMMENT("interpreter: continuing to use same coordinate system")
   10 N..... SET_MOTION_CONTROL_MODE(CANON_EXACT_PATH)
   11 N..... COMMENT("interpreter: cutter radius compensation off")
   12 N..... USE_TOOL_LENGTH_OFFSET(0.0000 0.0000 0.0000, 0.0000 0.0000 0.0000, 0.0000 0.0000 0.0000)
   13 N..... COMMENT("interpreter: motion mode set to none")
   14 N..... SELECT_TOOL(3)
   15 N..... START_CHANGE()
   16 N..... STOP_SPINDLE_TURNING(0)
   17 N..... COMMENT("AXIS,hide")
   18 N..... STRAIGHT_TRAVERSE(-11169.1702, -12909.2678, 5001.2600, 0.0000, 0.0000, 0.0000)
   19 N..... COMMENT("AXIS,show")
   20 N..... CHANGE_TOOL(2)
   21 N..... USE_TOOL_LENGTH_OFFSET(0.0000 0.0000 1346.2000, 0.0000 0.0000 0.0000, 0.0000 0.0000 0.0000)
   22 N..... SELECT_TOOL(1)
   23 N..... STRAIGHT_TRAVERSE(50.0000, 50.0000, 3655.0600, 0.0000, 0.0000, 0.0000)
   24 N..... STRAIGHT_TRAVERSE(50.0000, 50.0000, 30.0000, 0.0000, 0.0000, 0.0000)
   25 N..... SET_SPINDLE_SPEED(0, 3000.0000)
   26 N..... START_SPINDLE_CLOCKWISE(0)
   27 N..... FLOOD_ON()
   28 N..... STRAIGHT_TRAVERSE(50.0000, 50.0000, 10.0000, 0.0000, 0.0000, 0.0000)
   29 N..... SET_FEED_RATE(250.0000)
   30 N..... STRAIGHT_FEED(50.0000, 50.0000, 0.0000, 0.0000, 0.0000, 0.0000)
   31 N..... COMMENT("interpreter: cutter radius compensation on left")
   32 N..... SET_FEED_RATE(2000.0000)
   33 N..... MIST_OFF()
   34 N..... FLOOD_OFF()
   35 N..... COMMENT("interpreter: cutter radius compensation off")
   36 N..... START_CHANGE()
   37 N..... STOP_SPINDLE_TURNING(0)
   38 N..... COMMENT("AXIS,hide")
   39 N..... STRAIGHT_TRAVERSE(50.0000, 50.0000, 3655.0600, 0.0000, 0.0000, 0.0000)
   40 N..... COMMENT("AXIS,show")
   41 N..... CHANGE_TOOL(7)
   42 N..... USE_TOOL_LENGTH_OFFSET(0.0000 0.0000 3124.2000, 0.0000 0.0000 0.0000, 0.0000 0.0000 0.0000)
   43 N..... MESSAGE(" optional stop, i.e. for cleaning the workpiece, or other thinks")
   44 N..... OPTIONAL_PROGRAM_STOP()
   45 N..... STRAIGHT_TRAVERSE(50.0000, 50.0000, 1877.0600, 0.0000, 0.0000, 0.0000)
   46 N..... STRAIGHT_TRAVERSE(50.0000, 50.0000, 10.0000, 0.0000, 0.0000, 0.0000)
   47 N..... SET_SPINDLE_SPEED(0, 6000.0000)
   48 N..... START_SPINDLE_CLOCKWISE(0)
   49 N..... MIST_ON()
   50 N..... STRAIGHT_TRAVERSE(50.0000, 50.0000, 10.0000, 0.0000, 0.0000, 0.0000)
   51 N..... SET_FEED_RATE(400.0000)
   52 N..... STRAIGHT_FEED(50.0000, 50.0000, 1.0000, 0.0000, 0.0000, 0.0000)
   53 N..... COMMENT("interpreter: cutter radius compensation on left")
   54 N..... SET_FEED_RATE(1000.0000)
   55 N..... MIST_OFF()
   56 N..... FLOOD_OFF()
   57 N..... STOP_SPINDLE_TURNING(0)
   58 N..... SET_G5X_OFFSET(1, 8165.0024, 12700.0000, -5080.0000, 0.0000, 0.0000, 0.0000)
   59 N..... SET_XY_ROTATION(0.0000)
   60 N..... SET_FEED_MODE(0, 0)
   61 N..... SET_FEED_RATE(0.0000)
   62 N..... STOP_SPINDLE_TURNING(0)
   63 N..... SET_SPINDLE_MODE(0 0.0000)
   64 N..... PROGRAM_END()
   65 N..... ON_RESET()
... and these are the errors:
executing
Radius of cutter compensation entry arc is not greater than the tool radius
G3 X70 Y50 Z-1 I10 J0
Radius of cutter compensation entry arc is not greater than the tool radius
G3 I -20
Radius of cutter compensation entry arc is not greater than the tool radius
G3 X50 Y50 Z1 I-10 J0
Length of cutter compensation entry move is not greater than the tool radius
G0 Z30
Radius of cutter compensation entry arc is not greater than the tool radius
G3 X65 Y50 Z-1 I7.5 J0
Radius of cutter compensation entry arc is not greater than the tool radius
G3 I-15
Radius of cutter compensation entry arc is not greater than the tool radius
G3 X50 Y50 Z1 I-7.5 J0
Length of cutter compensation entry move is not greater than the tool radius
G0 Z30
Length of cutter compensation entry move is not greater than the tool radius
G0 Z30
Length of cutter compensation entry move is not greater than the tool radius
G0 X50 Y50

Axis or backend don't report any errors using same files.

Tool-Table is this:
T2 P1 Z20 D2 ;2.00mm 4 schneiden fräser
T3 P2 Z53 D3 ;3.00mm 2 flute endmill
T6 P3 Z30 D6 ;6.00mm 4 schneiden fräser
T4 P5 Z40 D8 ;8,00mm 4 schneiden fräser
T7 P8 Z50 D12 ;12,00mm 4 schneiden fräser
T1 P9 Z123 D4.568 ;45 deg v cutter



 

Please Log in or Create an account to join the conversation.

More
29 Sep 2021 14:08 #221832 by Reinhard
Hi,

I got a bit further with testing. My prototype for testing is available

With that prototype I can compare internal and external interpreter usage. When I use an oldstyle rip installation (with configure --enable-toolnml) everything works fine. Same is true, if external interpreter is used.
With a new style rip installation interpreter crashes with above stacktrace.
This crash is reproducible using sample gcode file from linuxcnc: gmoccapy_2_tools_with_cutter_radius_compensation.ngc

It seems, that tooldata_find_index_for_tool lacks some check for valid tool_mmap_base.
*hptr is NULL.

I don't know, whether I should have initialized that in my app.
So I'm asking for help.
 

Please Log in or Create an account to join the conversation.

Time to create page: 0.054 seconds
Powered by Kunena Forum