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

Segfault #31

Closed
jeff-davis opened this issue Apr 1, 2014 · 4 comments
Closed

Segfault #31

jeff-davis opened this issue Apr 1, 2014 · 4 comments

Comments

@jeff-davis
Copy link
Contributor

extern crate postgres;

use postgres::{PostgresConnection, NoSsl};
use postgres::types::ToSql;

fn main() {
  let mut content : ~str = ~"";
  {
    let conn = PostgresConnection::connect("postgres://jdavis@localhost:5432/postgres", &NoSsl).unwrap();
    let stmt = conn.prepare("SELECT x FROM t").unwrap();
    for row in stmt.query([]).unwrap() {
      let val : i32 = row[1];
      content.push_str(format!("<li>{}</li>\n", val));
    }
  }

  println!("{}", content);
}

Causes a segfault on the rust-nightly package I installed today (rustc 0.10-pre).

Backtrace:

(gdb) bt
#0  0x00007ffff7a9235d in _int_free (av=0x7ffff7dd3740 <main_arena>, p=0x8743a0, have_lock=0) at malloc.c:3924
#1  0x0000000000511ccb in _$UP$$UP$reseeding..ReseedingRng$LT$StdRng$C$TaskRngReseeder$GT$::glue_drop.5898::hca63f8a2631aec80 ()
#2  0x00000000008736d8 in ?? ()
#3  0x00000000005c352b in rt::task::Task::run::closure.41636 ()
#4  0x00000000005c3432 in rt::task::Task::run::closure.41627 ()
#5  0x00000000005ce9fc in rust_try ()
#6  0x00000000005c3282 in rt::task::Task::run::h3233312d889b0104os9::v0.10.pre ()
#7  0x0000000000441ef4 in start::h6478af498774a94fzvd::v0.10.pre ()
#8  0x0000000000441ce4 in lang_start::hdd717b0e84ff646bTud::v0.10.pre ()
#9  0x000000000040664f in main ()
@sfackler
Copy link
Owner

sfackler commented Apr 1, 2014

This is almost certainly a Rust bug. What OS are you on?

@sfackler
Copy link
Owner

sfackler commented Apr 1, 2014

I've filed an issue on what I believe the cause is as rust-lang/rust#13246. If you remove the bare block that's wrapping most of that example, everything should run okay.

@jeff-davis
Copy link
Contributor Author

Ubuntu 13.10 64-bit.

sfackler added a commit that referenced this issue Apr 8, 2014
This is a workaround for rust-lang/rust#13246 to prevent total badness
until it gets fixed.

cc #34, #31
@sfackler
Copy link
Owner

I believe this should be fixed by rust-lang/rust#21972.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants