#1866: broken db driver communication in winGRASS 7
------------------------------+---------------------------------------------
Reporter: martinl | Owner: grass-dev@…
Type: defect | Status: new
Priority: blocker | Milestone: 7.0.0
Component: Database | Version: unspecified
Keywords: sqlite, wingrass | Platform: MSWindows 2K
Cpu: Unspecified |
------------------------------+---------------------------------------------
Comment(by mmetz):
Replying to [comment:17 mmetz]:
> Replying to [comment:15 glynn]:
> > Replying to [comment:14 mmetz]:
> > > Fixed in r55332
> > r55332 doesn't fix anything, but instead breaks linking (because
libxdr typically won't exist).
>
> libxdr exists in osgeo4w [0]. I don't know why r55332 works, but it
works. IOW, r53256 works, r53257 does not work.
>
> > Reverted in r55335.
>
> I am inclined to revert r55335 until a proper solution is found.
> >
> > In what way does the DBMI client lib receive "garbage"? Is the data
simply corrupted, or does it bear absolutely no relation to what the
driver sends?
>
> The communication pipe first sends the size of the string, then the
string itself [1]. After the first few transmissions, the size of the
string as sent by the driver is correct, but the size of the string as
received by the dblib is too large. That means the driver continues
sending correct data with `db__send_string()` while `db__recv_string()`
still waits for a very large string to appear, which never appears. As a
result, nothing happens and the modules using dblib hang.
> [0] http://download.osgeo.org/osgeo4w/release/libxdr/libxdr/
> [1]
https://trac.osgeo.org/grass/browser/grass/trunk/lib/db/dbmi_base/xdrstring.c#L86
Some more information:
Linking only dbmi_base and/or dbmi_client against libxdr does not help.
Linking only gislib against xdrlib does not help either. The change in
r55332 is the only way I found to get the db drivers working.
Linking against xdr has been removed in order to get GRASS compiled on
Android, which is not a supported platform. I prefer to have GRASS working
on the supported platforms, even if it is a hack, and am thus restoring
r55332 until the underlying cause of the bug is found and fixed.
Testing in the NC dataset with
{{{
v.info -c map=boundary_county
}}}
I get with additional debug info in wingrass7 without libxdr
{{{
Displaying column types/names for database
D0/0: send string of len: 38
D0/0: send string of len: 1
D0/0: receive string of len: 38
D0/0: string received: C:\GRASSdata\nc_spm
D0/0: receive string of len: 1
D0/0: string received:
D0/0: send string of len: 16
D0/0: receive string of len: 16
D0/0: string received: boundary_county
D0/0: send column name: cat
D0/0: send string of len: 4
D0/0: D0/0: receive string of len: 4
}}}
The pipe is now broken because it continues with
{{{
D0/0: send string of len: 1
D0/0: send column name: AREA
D0/0: send string of len: 5
D0/0: send string of len: 1
D0/0: send column name: PERIMETER
D0/0: send string of len: 10
D0/0: send string of len: 1
D0/0: string received: cat
D0/0: column name: cat
D0/0: receive string of len: 1
D0/0: string received:
}}}
Here garbage is received: the string length received is 1280 instead of 5:
{{{
D0/0: receive string of len: 1280
send column name: FIPS
D0/0: send string of len: 5
D0/0: send string of len: 1
D0/0: send column name: NAME
D0/0: send string of len: 5
D0/0: send string of len: 1
D0/0: send column name: NAME_LOCAS
D0/0: send string of len: 11
D0/0: send string of len: 1
D0/0: send column name: DOT_DISTRI
D0/0: send string of len: 11
D0/0: send string of len: 1
D0/0: send column name: DOT_DIVISI
D0/0: send string of len: 11
D0/0: send string of len: 1
D0/0: send column name: DOT_COUNTY
D0/0: send string of len: 11
D0/0: send string of len: 1
D0/0: send column name: COUNTY_100
D0/0: send string of len: 11
D0/0: send string of len: 1
D0/0: send column name: DOT_GROUP_
D0/0: send string of len: 11
D0/0: send string of len: 1
D0/0: send column name: ACRES
D0/0: send string of len: 6
D0/0: send string of len: 1
D0/0: send column name: ABBR_5CHAR
D0/0: send string of len: 11
D0/0: send string of len: 1
D0/0: send column name: ABBR_4CHAR
D0/0: send string of len: 11
D0/0: send string of len: 1
D0/0: send column name: ABBR_2CHAR
D0/0: send string of len: 11
D0/0: send string of len: 1
D0/0: send column name: Z_MEAN
D0/0: send string of len: 7
D0/0: send string of len: 1
D0/0: send column name: Z_MIN
D0/0: send string of len: 6
D0/0: send string of len: 1
D0/0: send column name: Z_MAX
D0/0: send string of len: 6
D0/0: send string of len: 1
D0/0: send column name: Z_ZONE
D0/0: send string of len: 7
D0/0: send string of len: 1
D0/0: send column name: CO_CENSUS
D0/0: send string of len: 10
D0/0: send string of len: 1
D0/0: send column name: DIV_CONTAC
D0/0: send string of len: 11
D0/0: send string of len: 1
D0/0: send column name: DIST_CONTA
D0/0: send string of len: 11
D0/0: send string of len: 1
D0/0: send column name: CO_WIKIPED
D0/0: send string of len: 11
D0/0: send string of len: 1
D0/0: send column name: Shape_Leng
D0/0: send string of len: 11
D0/0: send string of len: 1
D0/0: send column name: Shape_Area
D0/0: send string of len: 11
D0/0: send string of len: 1
D0/0: send string of len: 16
D0/0: send string of len: 1
}}}
Linking against xdrlib I get
{{{
Displaying column types/names for data
D0/0: send string of len: 38
D0/0: send string of len: 1
D0/0: receive string of len: 38
D0/0: string received: C:\GRASSdata\nc
D0/0: receive string of len: 1
D0/0: string received:
D0/0: send string of len: 16
D0/0: receive string of len: 16
D0/0: string received: boundary_county
D0/0: send column name: cat
D0/0: send string of len: 4
D0/0: D0/0: receive string of len: 4
D0/0: string received: cat
D0/0: column name: cat
send string of len: 1
D0/0: D0/0: receive string of len: 1
D0/0: string received:
send column name: AREA
D0/0: send string of len: 5
D0/0: D0/0: receive string of len: 5
D0/0: string received: AREA
D0/0: column name: AREA
send string of len: 1
D0/0: D0/0: receive string of len: 1
D0/0: string received:
send column name: PERIMETER
D0/0: send string of len: 10
D0/0: D0/0: receive string of len: 10
D0/0: string received: PERIMETER
D0/0: column name: PERIMETER
send string of len: 1
D0/0: D0/0: receive string of len: 1
D0/0: string received:
send column name: FIPS
D0/0: send string of len: 5
D0/0: D0/0: receive string of len: 5
D0/0: string received: FIPS
D0/0: column name: FIPS
send string of len: 1
D0/0: D0/0: receive string of len: 1
D0/0: string received:
send column name: NAME
D0/0: send string of len: 5
D0/0: D0/0: receive string of len: 5
D0/0: string received: NAME
D0/0: column name: NAME
send string of len: 1
D0/0: D0/0: receive string of len: 1
D0/0: string received:
send column name: NAME_LOCAS
D0/0: send string of len: 11
D0/0: D0/0: receive string of len: 11
D0/0: string received: NAME_LOCAS
D0/0: column name: NAME_LOCAS
send string of len: 1
D0/0: D0/0: receive string of len: 1
D0/0: string received:
send column name: DOT_DISTRI
D0/0: send string of len: 11
D0/0: D0/0: receive string of len: 11
D0/0: string received: DOT_DISTRI
D0/0: column name: DOT_DISTRI
send string of len: 1
D0/0: D0/0: receive string of len: 1
D0/0: string received:
send column name: DOT_DIVISI
D0/0: send string of len: 11
D0/0: D0/0: receive string of len: 11
D0/0: string received: DOT_DIVISI
D0/0: column name: DOT_DIVISI
send string of len: 1
D0/0: D0/0: receive string of len: 1
D0/0: string received:
send column name: DOT_COUNTY
D0/0: send string of len: 11
D0/0: D0/0: receive string of len: 11
D0/0: string received: DOT_COUNTY
D0/0: column name: DOT_COUNTY
send string of len: 1
D0/0: D0/0: receive string of len: 1
D0/0: string received:
send column name: COUNTY_100
D0/0: send string of len: 11
D0/0: D0/0: receive string of len: 11
D0/0: string received: COUNTY_100
D0/0: column name: COUNTY_100
send string of len: 1
D0/0: D0/0: receive string of len: 1
D0/0: string received:
send column name: DOT_GROUP_
D0/0: send string of len: 11
D0/0: D0/0: receive string of len: 11
D0/0: string received: DOT_GROUP_
D0/0: column name: DOT_GROUP_
send string of len: 1
D0/0: D0/0: receive string of len: 1
D0/0: string received:
send column name: ACRES
D0/0: send string of len: 6
D0/0: D0/0: receive string of len: 6
D0/0: string received: ACRES
D0/0: column name: ACRES
send string of len: 1
D0/0: D0/0: receive string of len: 1
D0/0: string received:
send column name: ABBR_5CHAR
D0/0: send string of len: 11
D0/0: D0/0: receive string of len: 11
D0/0: string received: ABBR_5CHAR
D0/0: column name: ABBR_5CHAR
send string of len: 1
D0/0: D0/0: receive string of len: 1
D0/0: string received:
send column name: ABBR_4CHAR
D0/0: send string of len: 11
D0/0: D0/0: receive string of len: 11
D0/0: string received: ABBR_4CHAR
D0/0: column name: ABBR_4CHAR
send string of len: 1
D0/0: D0/0: receive string of len: 1
D0/0: string received:
send column name: ABBR_2CHAR
D0/0: send string of len: 11
D0/0: D0/0: receive string of len: 11
D0/0: string received: ABBR_2CHAR
D0/0: column name: ABBR_2CHAR
send string of len: 1
D0/0: D0/0: receive string of len: 1
D0/0: string received:
send column name: Z_MEAN
D0/0: send string of len: 7
D0/0: D0/0: receive string of len: 7
D0/0: string received: Z_MEAN
D0/0: column name: Z_MEAN
send string of len: 1
D0/0: D0/0: receive string of len: 1
D0/0: string received:
send column name: Z_MIN
D0/0: send string of len: 6
D0/0: D0/0: receive string of len: 6
D0/0: string received: Z_MIN
D0/0: column name: Z_MIN
send string of len: 1
D0/0: D0/0: receive string of len: 1
D0/0: string received:
send column name: Z_MAX
D0/0: send string of len: 6
D0/0: D0/0: receive string of len: 6
D0/0: string received: Z_MAX
D0/0: column name: Z_MAX
send string of len: 1
D0/0: D0/0: receive string of len: 1
D0/0: string received:
send column name: Z_ZONE
D0/0: send string of len: 7
D0/0: D0/0: receive string of len: 7
D0/0: string received: Z_ZONE
D0/0: column name: Z_ZONE
send string of len: 1
D0/0: D0/0: receive string of len: 1
D0/0: string received:
send column name: CO_CENSUS
D0/0: send string of len: 10
D0/0: D0/0: receive string of len: 10
D0/0: string received: CO_CENSUS
D0/0: column name: CO_CENSUS
send string of len: 1
D0/0: D0/0: receive string of len: 1
D0/0: string received:
send column name: DIV_CONTAC
D0/0: send string of len: 11
D0/0: D0/0: receive string of len: 11
D0/0: string received: DIV_CONTAC
D0/0: column name: DIV_CONTAC
send string of len: 1
D0/0: D0/0: receive string of len: 1
D0/0: string received:
send column name: DIST_CONTA
D0/0: send string of len: 11
D0/0: D0/0: receive string of len: 11
D0/0: string received: DIST_CONTA
D0/0: column name: DIST_CONTA
send string of len: 1
D0/0: D0/0: receive string of len: 1
D0/0: string received:
send column name: CO_WIKIPED
D0/0: send string of len: 11
D0/0: D0/0: receive string of len: 11
D0/0: string received: CO_WIKIPED
D0/0: column name: CO_WIKIPED
send string of len: 1
D0/0: D0/0: receive string of len: 1
D0/0: string received:
send column name: Shape_Leng
D0/0: send string of len: 11
D0/0: D0/0: receive string of len: 11
D0/0: string received: Shape_Leng
D0/0: column name: Shape_Leng
send string of len: 1
D0/0: D0/0: receive string of len: 1
D0/0: string received:
send column name: Shape_Area
D0/0: send string of len: 11
D0/0: D0/0: receive string of len: 11
D0/0: string received: Shape_Area
D0/0: column name: Shape_Area
send string of len: 1
D0/0: D0/0: receive string of len: 1
D0/0: string received:
send string of len: 16
D0/0: D0/0: receive string of len: 16
D0/0: string received: boundary_county
send string of len: 1
D0/0: receive string of len: 1
D0/0: string received:
INTEGER|cat
DOUBLE PRECISION|AREA
DOUBLE PRECISION|PERIMETER
DOUBLE PRECISION|FIPS
CHARACTER VARYING|NAME
CHARACTER VARYING|NAME_LOCAS
INTEGER|DOT_DISTRI
INTEGER|DOT_DIVISI
INTEGER|DOT_COUNTY
INTEGER|COUNTY_100
CHARACTER VARYING|DOT_GROUP_
DOUBLE PRECISION|ACRES
CHARACTER VARYING|ABBR_5CHAR
CHARACTER VARYING|ABBR_4CHAR
CHARACTER VARYING|ABBR_2CHAR
DOUBLE PRECISION|Z_MEAN
DOUBLE PRECISION|Z_MIN
DOUBLE PRECISION|Z_MAX
DOUBLE PRECISION|Z_ZONE
CHARACTER VARYING|CO_CENSUS
CHARACTER VARYING|DIV_CONTAC
CHARACTER VARYING|DIST_CONTA
CHARACTER VARYING|CO_WIKIPED
DOUBLE PRECISION|Shape_Leng
DOUBLE PRECISION|Shape_Area
GRASS 7.0.svn>
}}}
--
Ticket URL: <https://trac.osgeo.org/grass/ticket/1866#comment:19>
GRASS GIS <http://grass.osgeo.org>