Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segmentation fault on v0.7 #212

Closed
evetion opened this issue Jul 1, 2021 · 2 comments · Fixed by #214
Closed

Segmentation fault on v0.7 #212

evetion opened this issue Jul 1, 2021 · 2 comments · Fixed by #214
Labels

Comments

@evetion
Copy link
Collaborator

evetion commented Jul 1, 2021

In upgrading GeoDataFrames to ArchGDAL 0.7 (evetion/GeoDataFrames.jl#21) I hit a segmentation fault. I can reproduce it to the following code on macOS when using Julia 1.6. 1.7 seems to work, but most of the platforms fail the CI in the PR.

using ArchGDAL; const AG=ArchGDAL

AG.createlayer(
    name="test",
    geom=AG.GDAL.wkbPoint,
    ) do layer
        AG.addfielddefn!(layer, "test", convert(AG.OGRFieldType, String))
end

results in

signal (11): Segmentation fault: 11
in expression starting at /Users/evetion/code/GeoDataFrames/test/runtests.jl:30
OGR_L_CreateField at /Users/evetion/.julia/artifacts/dce3145800aa7866bf5cdbedd3ac40850df3fc47/lib/libgdal.28.dylib (unknown line)
ogr_l_createfield at /Users/evetion/.julia/packages/GDAL/5CClC/src/ogr_api.jl:4526 [inlined]
addfielddefn! at /Users/evetion/.julia/packages/ArchGDAL/wt2FK/src/ogr/featurelayer.jl:818 [inlined]
addfielddefn! at /Users/evetion/.julia/packages/ArchGDAL/wt2FK/src/ogr/featurelayer.jl:818 [inlined]
#addfielddefn!#221 at /Users/evetion/.julia/packages/ArchGDAL/wt2FK/src/context.jl:123
addfielddefn! at /Users/evetion/.julia/packages/ArchGDAL/wt2FK/src/context.jl:114 [inlined]
#12 at /Users/evetion/code/GeoDataFrames/src/io.jl:54
#createlayer#239 at /Users/evetion/.julia/packages/ArchGDAL/wt2FK/src/context.jl:267
createlayer##kw at /Users/evetion/.julia/packages/ArchGDAL/wt2FK/src/context.jl:265 [inlined]
#11 at /Users/evetion/code/GeoDataFrames/src/io.jl:47 [inlined]
#create#229 at /Users/evetion/.julia/packages/ArchGDAL/wt2FK/src/context.jl:267
create##kw at /Users/evetion/.julia/packages/ArchGDAL/wt2FK/src/context.jl:265 [inlined]
#write#10 at /Users/evetion/code/GeoDataFrames/src/io.jl:43
write at /Users/evetion/code/GeoDataFrames/src/io.jl:20
@yeesian yeesian added the bug label Jul 3, 2021
@yeesian
Copy link
Owner

yeesian commented Jul 3, 2021

I'm not able to reproduce the error in #212 (comment), but it resulted in an error for me nonetheless:

  | | |_| | | | (_| |  |  Version 1.6.0 (2021-03-24)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

julia> using ArchGDAL; const AG=ArchGDAL
ArchGDAL

julia> AG.createlayer(
           name="test",
           geom=AG.GDAL.wkbPoint,
           ) do layer
               AG.addfielddefn!(layer, "test", convert(AG.OGRFieldType, String))
       end
ERROR: TypeError: in keyword argument geom, expected ArchGDAL.OGRwkbGeometryType, got a value of type GDAL.OGRwkbGeometryType
Stacktrace:
 [1] createlayer(::var"#3#4"; kwargs::Base.Iterators.Pairs{Symbol, Any, Tuple{Symbol, Symbol}, NamedTuple{(:name, :geom), Tuple{String, GDAL.OGRwkbGeometryType}}})
   @ ArchGDAL ~/.julia/packages/ArchGDAL/IuyJL/src/context.jl:265
 [2] top-level scope
   @ REPL[2]:1

Here's the environment:

(@v1.6) pkg> st
      Status `~/.julia/environments/v1.6/Project.toml`
  [4c88cf16] Aqua v0.5.0
  [c9ce4bd3] ArchGDAL v0.7.0
  [6e4b80f9] BenchmarkTools v0.5.0
  [12aac903] BinaryBuilder v0.3.3
  [fa961155] CEnum v0.4.1
  [3da002f7] ColorTypes v0.11.0
  [a93c6f00] DataFrames v1.0.1
  [3c3547ce] DiskArrays v0.2.7
  [e30172f5] Documenter v0.26.3
  [add2ef01] GDAL v1.2.1
  [cf35fbd7] GeoInterface v0.5.5
  [a09fc81d] ImageCore v0.9.0
  [d8c32880] ImageInTerminal v0.4.6
  [98e50ef6] JuliaFormatter v0.13.10
  [32113eaa] PkgBenchmark v0.2.10
  [91a5bcdd] Plots v1.13.2
  [295af30f] Revise v3.1.15
  [aa65fe97] SnoopCompile v2.6.0
  [e2b509da] SnoopCompileCore v2.5.2
  [bd369af6] Tables v1.4.2
  [d3a6a179] TerminalExtensions v0.4.0

@yeesian
Copy link
Owner

yeesian commented Jul 3, 2021

Am now able to reproduce when I replace AG.GDAL.wkbPoint with AG.wkbPoint in #212 (comment).

yeesian added a commit that referenced this issue Jul 3, 2021
yeesian added a commit that referenced this issue Jul 5, 2021
* Bugfix for dataset ownership when creating layers

Fixes #212

* Update type for FeatureLayer

It should have a corresponding dataset for "floating layers" that were constructed "layer-first"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants